#1490 - FIX: withQuote_when_match for different platforms

This commit is contained in:
Rob Bygrave committed 2018-09-26 21:33:27 +12:00
1 parent b817d5ee4d
commit 9734ae5787
2 files changed
+10 -6

No files matched your search

@@ -3,7 +3,6 @@ package io.ebeaninternal.server.deploy;
import io.ebean.BaseTestCase;
import io.ebean.annotation.ForPlatform;
import io.ebean.annotation.Platform;
import org.junit.Test;
import org.tests.model.basic.Address;
import org.tests.model.basic.BWithQIdent;
@@ -55,25 +54,29 @@ public class DeployPropertyParserTest extends BaseTestCase {
assertThat(addressParser().parse("concat(line1, line2, '-EA')")).isEqualTo("concat(${}line_1, ${}line_2, '-EA')");
}
@Test
public void withExplicitQuote_all_platforms() {
assertThat(withQuoteParser().parse("t0.`CODE` like ?")).isEqualTo("t0.`CODE` like ?");
assertThat(withQuoteParser().parse("t0.[CODE] like ?")).isEqualTo("t0.[CODE] like ?");
assertThat(withQuoteParser().parse("t0.\"CODE\" like ?")).isEqualTo("t0.\"CODE\" like ?");
}
@Test
@ForPlatform(value = {Platform.H2, Platform.POSTGRES})
public void withQuote_when_match_h2() {
assertThat(withQuoteParser().parse("name like ?")).isEqualTo("${}\"Name\" like ?");
assertThat(withQuoteParser().parse("t0.\"CODE\" like ?")).isEqualTo("t0.\"CODE\" like ?");
}
@Test
@ForPlatform(value = Platform.SQLSERVER)
public void withQuote_when_match_sqlserver() {
assertThat(withQuoteParser().parse("name like ?")).isEqualTo("${}[Name] like ?");
assertThat(withQuoteParser().parse("t0.[CODE] like ?")).isEqualTo("t0.[CODE] like ?");
}
@Test
@ForPlatform(value = Platform.MYSQL)
public void withQuote_when_match_mysql() {
assertThat(withQuoteParser().parse("name like ?")).isEqualTo("${}`Name` like ?");
assertThat(withQuoteParser().parse("t0.`CODE` like ?")).isEqualTo("t0.`CODE` like ?");
}
@Test