FIX: withQuote_when:_match for different platforms (#1490)

This commit is contained in:
Roland Praml
2018-09-26 21:26:29 +12:00
committed by Rob Bygrave
parent 0036473971
commit b817d5ee4d
@@ -1,6 +1,9 @@
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;
@@ -53,11 +56,26 @@ public class DeployPropertyParserTest extends BaseTestCase {
}
@Test
public void withQuote_when_match() {
@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
public void unknown_path() {
assertThat(parser().parse(" foo ")).isEqualTo(" foo ");