diff --git a/src/main/java/io/ebeaninternal/server/expression/BetweenExpression.java b/src/main/java/io/ebeaninternal/server/expression/BetweenExpression.java index 410323cdf..bfdfa1d52 100644 --- a/src/main/java/io/ebeaninternal/server/expression/BetweenExpression.java +++ b/src/main/java/io/ebeaninternal/server/expression/BetweenExpression.java @@ -7,7 +7,7 @@ import java.io.IOException; class BetweenExpression extends AbstractExpression { - private static final String BETWEEN = " between "; + private static final String _BETWEEN = " between ? and ?"; private final Object valueHigh; @@ -40,7 +40,7 @@ class BetweenExpression extends AbstractExpression { @Override public void addSql(SpiExpressionRequest request) { - request.append(propName).append(BETWEEN).append(" ? and ? "); + request.append(propName).append(_BETWEEN); } @Override diff --git a/src/main/java/io/ebeaninternal/server/expression/BetweenPropertyExpression.java b/src/main/java/io/ebeaninternal/server/expression/BetweenPropertyExpression.java index 43574a95d..798908335 100644 --- a/src/main/java/io/ebeaninternal/server/expression/BetweenPropertyExpression.java +++ b/src/main/java/io/ebeaninternal/server/expression/BetweenPropertyExpression.java @@ -1,12 +1,12 @@ package io.ebeaninternal.server.expression; +import io.ebean.util.SplitName; import io.ebeaninternal.api.ManyWhereJoins; import io.ebeaninternal.api.SpiExpression; import io.ebeaninternal.api.SpiExpressionRequest; import io.ebeaninternal.api.SpiExpressionValidation; import io.ebeaninternal.server.deploy.BeanDescriptor; import io.ebeaninternal.server.el.ElPropertyDeploy; -import io.ebean.util.SplitName; import java.io.IOException; @@ -80,7 +80,7 @@ class BetweenPropertyExpression extends NonPrepareExpression { @Override public void addSql(SpiExpressionRequest request) { - request.append(" ?").append(BETWEEN).append(name(lowProperty)).append(" and ").append(name(highProperty)).append(" "); + request.append(" ?").append(BETWEEN).append(name(lowProperty)).append(" and ").append(name(highProperty)); } @Override diff --git a/src/main/java/io/ebeaninternal/server/expression/CaseInsensitiveEqualExpression.java b/src/main/java/io/ebeaninternal/server/expression/CaseInsensitiveEqualExpression.java index afa352940..4eee83648 100644 --- a/src/main/java/io/ebeaninternal/server/expression/CaseInsensitiveEqualExpression.java +++ b/src/main/java/io/ebeaninternal/server/expression/CaseInsensitiveEqualExpression.java @@ -53,9 +53,9 @@ class CaseInsensitiveEqualExpression extends AbstractValueExpression { pname = prop.getBeanProperty().getDecryptProperty(propName); } if (not) { - request.append("lower(").append(pname).append(") !=? "); + request.append("lower(").append(pname).append(") != ?"); } else { - request.append("lower(").append(pname).append(") =? "); + request.append("lower(").append(pname).append(") = ?"); } } diff --git a/src/main/java/io/ebeaninternal/server/expression/DefaultExampleExpression.java b/src/main/java/io/ebeaninternal/server/expression/DefaultExampleExpression.java index 53653e416..2a0fd2bd8 100644 --- a/src/main/java/io/ebeaninternal/server/expression/DefaultExampleExpression.java +++ b/src/main/java/io/ebeaninternal/server/expression/DefaultExampleExpression.java @@ -212,7 +212,7 @@ public class DefaultExampleExpression implements SpiExpression, ExampleExpressio } item.addSql(request); } - request.append(") "); + request.append(")"); } } diff --git a/src/main/java/io/ebeaninternal/server/expression/ExistsQueryExpression.java b/src/main/java/io/ebeaninternal/server/expression/ExistsQueryExpression.java index c6c214f4e..8918bd05d 100644 --- a/src/main/java/io/ebeaninternal/server/expression/ExistsQueryExpression.java +++ b/src/main/java/io/ebeaninternal/server/expression/ExistsQueryExpression.java @@ -2,6 +2,7 @@ package io.ebeaninternal.server.expression; import io.ebean.event.BeanQueryRequest; import io.ebeaninternal.api.ManyWhereJoins; +import io.ebeaninternal.api.NaturalKeyQueryData; import io.ebeaninternal.api.SpiEbeanServer; import io.ebeaninternal.api.SpiExpression; import io.ebeaninternal.api.SpiExpressionRequest; @@ -9,7 +10,6 @@ import io.ebeaninternal.api.SpiExpressionValidation; import io.ebeaninternal.api.SpiQuery; import io.ebeaninternal.server.deploy.BeanDescriptor; import io.ebeaninternal.server.query.CQuery; -import io.ebeaninternal.api.NaturalKeyQueryData; import java.io.IOException; import java.util.List; @@ -98,7 +98,7 @@ class ExistsQueryExpression implements SpiExpression, UnsupportedDocStoreExpress } request.append(" exists ("); request.append(sql); - request.append(") "); + request.append(")"); } @Override diff --git a/src/main/java/io/ebeaninternal/server/expression/IdExpression.java b/src/main/java/io/ebeaninternal/server/expression/IdExpression.java index ad7769ae9..12910fb37 100644 --- a/src/main/java/io/ebeaninternal/server/expression/IdExpression.java +++ b/src/main/java/io/ebeaninternal/server/expression/IdExpression.java @@ -60,7 +60,7 @@ class IdExpression extends NonPrepareExpression implements SpiExpression { DefaultExpressionRequest r = (DefaultExpressionRequest) request; String idSql = r.getBeanDescriptor().getIdBinderIdSql(null); - request.append(idSql).append(" "); + request.append(idSql); } /** diff --git a/src/main/java/io/ebeaninternal/server/expression/InQueryExpression.java b/src/main/java/io/ebeaninternal/server/expression/InQueryExpression.java index b0681e720..83507af4b 100644 --- a/src/main/java/io/ebeaninternal/server/expression/InQueryExpression.java +++ b/src/main/java/io/ebeaninternal/server/expression/InQueryExpression.java @@ -85,7 +85,7 @@ class InQueryExpression extends AbstractExpression implements UnsupportedDocStor } request.append(" in ("); request.append(sql); - request.append(") "); + request.append(")"); } @Override diff --git a/src/main/java/io/ebeaninternal/server/expression/InRangeExpression.java b/src/main/java/io/ebeaninternal/server/expression/InRangeExpression.java index 837186871..e1d170b43 100644 --- a/src/main/java/io/ebeaninternal/server/expression/InRangeExpression.java +++ b/src/main/java/io/ebeaninternal/server/expression/InRangeExpression.java @@ -38,7 +38,7 @@ class InRangeExpression extends AbstractExpression { @Override public void addSql(SpiExpressionRequest request) { - request.append("(").append(propName).append(" >= ? and ").append(propName).append(" < ?) "); + request.append("(").append(propName).append(" >= ? and ").append(propName).append(" < ?)"); } @Override diff --git a/src/main/java/io/ebeaninternal/server/expression/JunctionExpression.java b/src/main/java/io/ebeaninternal/server/expression/JunctionExpression.java index 8d0f8f924..c1ed7b611 100644 --- a/src/main/java/io/ebeaninternal/server/expression/JunctionExpression.java +++ b/src/main/java/io/ebeaninternal/server/expression/JunctionExpression.java @@ -192,7 +192,7 @@ class JunctionExpression implements SpiJunction, SpiExpression, Expression } item.addSql(request); } - request.append(") "); + request.append(")"); } } diff --git a/src/main/java/io/ebeaninternal/server/expression/LikeExpression.java b/src/main/java/io/ebeaninternal/server/expression/LikeExpression.java index 1d782f57c..6886203c4 100644 --- a/src/main/java/io/ebeaninternal/server/expression/LikeExpression.java +++ b/src/main/java/io/ebeaninternal/server/expression/LikeExpression.java @@ -51,7 +51,7 @@ class LikeExpression extends AbstractValueExpression { request.append(pname); } if (type == LikeType.EQUAL_TO) { - request.append(" = ? "); + request.append(" = ?"); } else { // append db platform like clause request.appendLike(type == LikeType.RAW); diff --git a/src/main/java/io/ebeaninternal/server/expression/LogicExpression.java b/src/main/java/io/ebeaninternal/server/expression/LogicExpression.java index 2dd7a4882..0fa0d9b37 100644 --- a/src/main/java/io/ebeaninternal/server/expression/LogicExpression.java +++ b/src/main/java/io/ebeaninternal/server/expression/LogicExpression.java @@ -4,11 +4,11 @@ import io.ebean.Expression; import io.ebean.Junction; import io.ebean.event.BeanQueryRequest; import io.ebeaninternal.api.ManyWhereJoins; +import io.ebeaninternal.api.NaturalKeyQueryData; import io.ebeaninternal.api.SpiExpression; import io.ebeaninternal.api.SpiExpressionRequest; import io.ebeaninternal.api.SpiExpressionValidation; import io.ebeaninternal.server.deploy.BeanDescriptor; -import io.ebeaninternal.api.NaturalKeyQueryData; import java.io.IOException; @@ -140,7 +140,7 @@ abstract class LogicExpression implements SpiExpression { expOne.addSql(request); request.append(conjunction ? AND : OR); expTwo.addSql(request); - request.append(") "); + request.append(")"); } @Override diff --git a/src/main/java/io/ebeaninternal/server/expression/NativeILikeExpression.java b/src/main/java/io/ebeaninternal/server/expression/NativeILikeExpression.java index a9298e209..c3376f656 100644 --- a/src/main/java/io/ebeaninternal/server/expression/NativeILikeExpression.java +++ b/src/main/java/io/ebeaninternal/server/expression/NativeILikeExpression.java @@ -42,7 +42,7 @@ class NativeILikeExpression extends AbstractExpression { pname = prop.getBeanProperty().getDecryptProperty(propName); } - request.append(pname).append(" ilike ? "); + request.append(pname).append(" ilike ?"); } /** diff --git a/src/main/java/io/ebeaninternal/server/expression/NoopExpression.java b/src/main/java/io/ebeaninternal/server/expression/NoopExpression.java index 6d6a7a58a..69759e595 100644 --- a/src/main/java/io/ebeaninternal/server/expression/NoopExpression.java +++ b/src/main/java/io/ebeaninternal/server/expression/NoopExpression.java @@ -2,11 +2,11 @@ package io.ebeaninternal.server.expression; import io.ebean.event.BeanQueryRequest; import io.ebeaninternal.api.ManyWhereJoins; +import io.ebeaninternal.api.NaturalKeyQueryData; import io.ebeaninternal.api.SpiExpression; import io.ebeaninternal.api.SpiExpressionRequest; import io.ebeaninternal.api.SpiExpressionValidation; import io.ebeaninternal.server.deploy.BeanDescriptor; -import io.ebeaninternal.api.NaturalKeyQueryData; import java.io.IOException; @@ -76,7 +76,7 @@ class NoopExpression implements SpiExpression { @Override public void addSql(SpiExpressionRequest request) { - request.append("1=1 "); + request.append("1=1"); } @Override diff --git a/src/main/java/io/ebeaninternal/server/expression/NotExpression.java b/src/main/java/io/ebeaninternal/server/expression/NotExpression.java index 8bafa95b0..29535cd95 100644 --- a/src/main/java/io/ebeaninternal/server/expression/NotExpression.java +++ b/src/main/java/io/ebeaninternal/server/expression/NotExpression.java @@ -3,18 +3,18 @@ package io.ebeaninternal.server.expression; import io.ebean.Expression; import io.ebean.event.BeanQueryRequest; import io.ebeaninternal.api.ManyWhereJoins; +import io.ebeaninternal.api.NaturalKeyQueryData; import io.ebeaninternal.api.SpiExpression; import io.ebeaninternal.api.SpiExpressionRequest; import io.ebeaninternal.api.SpiExpressionValidation; import io.ebeaninternal.server.deploy.BeanDescriptor; -import io.ebeaninternal.api.NaturalKeyQueryData; import java.io.IOException; final class NotExpression implements SpiExpression { private static final String NOT_START = "not ("; - private static final String NOT_END = ") "; + private static final String NOT_END = ")"; private final SpiExpression exp; diff --git a/src/main/java/io/ebeaninternal/server/expression/NullExpression.java b/src/main/java/io/ebeaninternal/server/expression/NullExpression.java index 51ac7b27a..90894dbde 100644 --- a/src/main/java/io/ebeaninternal/server/expression/NullExpression.java +++ b/src/main/java/io/ebeaninternal/server/expression/NullExpression.java @@ -66,7 +66,7 @@ class NullExpression extends AbstractExpression { return; } - String nullExpr = notNull ? " is not null " : " is null "; + String nullExpr = notNull ? " is not null" : " is null"; if (elProperty != null && elProperty.isAssocId()) { request.append(elProperty.getAssocIdExpression(propName, nullExpr)); } else { diff --git a/src/main/java/io/ebeaninternal/server/expression/Op.java b/src/main/java/io/ebeaninternal/server/expression/Op.java index 90321dc0e..1e20ddeba 100644 --- a/src/main/java/io/ebeaninternal/server/expression/Op.java +++ b/src/main/java/io/ebeaninternal/server/expression/Op.java @@ -8,48 +8,48 @@ public enum Op { /** * Exists (JSON). */ - EXISTS(" is not null ", ""), + EXISTS(" is not null", ""), /** * Not Exists (JSON). */ - NOT_EXISTS(" is null ", ""), + NOT_EXISTS(" is null", ""), /** * Between (JSON). */ - BETWEEN(" between ? and ? ", ""), + BETWEEN(" between ? and ?", ""), /** * Equal to */ - EQ(" = ? ", ""), + EQ(" = ?", ""), /** * Not equal to. */ - NOT_EQ(" <> ? ", ""), + NOT_EQ(" <> ?", ""), /** * Less than. */ - LT(" < ? ", "lt"), + LT(" < ?", "lt"), /** * Less than or equal to. */ - LT_EQ(" <= ? ", "lte"), + LT_EQ(" <= ?", "lte"), /** * Greater than. */ - GT(" > ? ", "gt"), + GT(" > ?", "gt"), /** * Greater than or equal to. */ - GT_EQ(" >= ? ", "gte"); + GT_EQ(" >= ?", "gte"); final String exp; diff --git a/src/test/java/io/ebean/DtoQueryFromOrmTest.java b/src/test/java/io/ebean/DtoQueryFromOrmTest.java index 0288e4732..c5dca5d7e 100644 --- a/src/test/java/io/ebean/DtoQueryFromOrmTest.java +++ b/src/test/java/io/ebean/DtoQueryFromOrmTest.java @@ -91,7 +91,7 @@ public class DtoQueryFromOrmTest extends BaseTestCase { List sql = LoggedSqlCollector.stop(); assertThat(sql.get(0)).contains("select t0.id, t0.email, " + concat("t0.last_name", ", ", "t0.first_name") - + " fullName from contact t0 where t0.email is not null and t0.last_name is not null order by t0.last_name"); + + " fullName from contact t0 where t0.email is not null and t0.last_name is not null order by t0.last_name"); } @Test @@ -117,7 +117,7 @@ public class DtoQueryFromOrmTest extends BaseTestCase { List sql = LoggedSqlCollector.stop(); assertThat(sql.get(0)).contains("select t0.email, " + concat("t0.last_name", ", ", "t0.first_name") - + " fullName from contact t0 where t0.email is not null and t0.last_name is not null order by t0.last_name"); + + " fullName from contact t0 where t0.email is not null and t0.last_name is not null order by t0.last_name"); } @Test @@ -147,7 +147,7 @@ public class DtoQueryFromOrmTest extends BaseTestCase { } else { assertThat(sql.get(0)).contains("select t0.email, " + concat("t0.last_name", ", ", "t0.first_name") - + " fullName from contact t0 where t0.email is not null and t0.last_name is not null order by t0.last_name"); + + " fullName from contact t0 where t0.email is not null and t0.last_name is not null order by t0.last_name"); } } @@ -178,7 +178,7 @@ public class DtoQueryFromOrmTest extends BaseTestCase { + " fullName from contact t0 where t0.email is not null and t0.last_name is not null order by t0.last_name"); } else { assertThat(sql.get(0)).contains("select t0.id, t0.email, " + concat("t0.last_name", ", ", "t0.first_name") - + " fullName from contact t0 where t0.email is not null and t0.last_name is not null order by t0.last_name"); + + " fullName from contact t0 where t0.email is not null and t0.last_name is not null order by t0.last_name"); } } @@ -227,7 +227,7 @@ public class DtoQueryFromOrmTest extends BaseTestCase { List sql = LoggedSqlCollector.stop(); assertThat(sql.get(0)).contains( - "select t0.last_name, count(*) totalCount from contact t0 where t0.last_name is not null group by t0.last_name having count(*) > ?"); + "select t0.last_name, count(*) totalCount from contact t0 where t0.last_name is not null group by t0.last_name having count(*) > ?"); } @Test diff --git a/src/test/java/io/ebean/UpdateQueryTest.java b/src/test/java/io/ebean/UpdateQueryTest.java index 5a5d9b698..0a078d26b 100644 --- a/src/test/java/io/ebean/UpdateQueryTest.java +++ b/src/test/java/io/ebean/UpdateQueryTest.java @@ -36,7 +36,7 @@ public class UpdateQueryTest extends BaseTestCase { query.update(); - assertThat(query.getGeneratedSql()).contains("update o_customer set status=?, updtime=? where status = ? and id > ?"); + assertThat(query.getGeneratedSql()).contains("update o_customer set status=?, updtime=? where status = ? and id > ?"); BasicMetricVisitor basic = visitMetricsBasic(); List ormQueryMetrics = basic.getOrmQueryMetrics(); @@ -166,7 +166,7 @@ public class UpdateQueryTest extends BaseTestCase { query.update(); - assertThat(sqlOf(query)).contains("update o_customer set status=?, updtime=? where id in (select t0.id from o_customer t0 left join o_address t1 on t1.id = t0.billing_address_id where t0.status = ? and t1.country_code = ? and t0.id > ? )"); + assertThat(sqlOf(query)).contains("update o_customer set status=?, updtime=? where id in (select t0.id from o_customer t0 left join o_address t1 on t1.id = t0.billing_address_id where t0.status = ? and t1.country_code = ? and t0.id > ?)"); } @Test diff --git a/src/test/java/io/ebeaninternal/server/expression/BetweenExpressionTest.java b/src/test/java/io/ebeaninternal/server/expression/BetweenExpressionTest.java index 82f742247..950c492dd 100644 --- a/src/test/java/io/ebeaninternal/server/expression/BetweenExpressionTest.java +++ b/src/test/java/io/ebeaninternal/server/expression/BetweenExpressionTest.java @@ -8,18 +8,18 @@ import static org.assertj.core.api.StrictAssertions.assertThat; public class BetweenExpressionTest extends BaseExpressionTest { @Test - public void addSql() throws Exception { + public void addSql() { DefaultExpressionRequest expReq = newExpressionRequest(); BetweenExpression exp = new BetweenExpression("startDate", 1, 2); exp.addSql(expReq); - assertThat(expReq.getSql()).isEqualTo("startDate between ? and ? "); + assertThat(expReq.getSql()).isEqualTo("startDate between ? and ?"); } @Test - public void copyForPlanKey_isSameInstance() throws Exception { + public void copyForPlanKey_isSameInstance() { BetweenExpression exp = new BetweenExpression("startDate", 1, 2); SpiExpression other = exp.copyForPlanKey(); @@ -28,7 +28,7 @@ public class BetweenExpressionTest extends BaseExpressionTest { } @Test - public void isSameByPlan_when_properties_match() throws Exception { + public void isSameByPlan_when_properties_match() { BetweenExpression exp0 = new BetweenExpression("startDate", 1, 2); BetweenExpression exp1 = new BetweenExpression("startDate", 3, 4); @@ -38,7 +38,7 @@ public class BetweenExpressionTest extends BaseExpressionTest { } @Test - public void isSameByPlan_when_properties_do_not_match() throws Exception { + public void isSameByPlan_when_properties_do_not_match() { BetweenExpression exp0 = new BetweenExpression("startDate", 1, 2); BetweenExpression exp1 = new BetweenExpression("endDate", 1, 2); @@ -48,7 +48,7 @@ public class BetweenExpressionTest extends BaseExpressionTest { } @Test - public void isSameByBind_when_values_do_not_match() throws Exception { + public void isSameByBind_when_values_do_not_match() { BetweenExpression exp0 = new BetweenExpression("startDate", 1, 2); BetweenExpression exp1 = new BetweenExpression("startDate", 1, 3); @@ -58,7 +58,7 @@ public class BetweenExpressionTest extends BaseExpressionTest { } @Test - public void isSameByBind_when_values_match() throws Exception { + public void isSameByBind_when_values_match() { BetweenExpression exp0 = new BetweenExpression("startDate", 1, 2); BetweenExpression exp1 = new BetweenExpression("startDate", 1, 2); diff --git a/src/test/java/io/ebeaninternal/server/expression/BetweenPropertyExpressionTest.java b/src/test/java/io/ebeaninternal/server/expression/BetweenPropertyExpressionTest.java index b4de23798..a7ab9e343 100644 --- a/src/test/java/io/ebeaninternal/server/expression/BetweenPropertyExpressionTest.java +++ b/src/test/java/io/ebeaninternal/server/expression/BetweenPropertyExpressionTest.java @@ -14,7 +14,7 @@ public class BetweenPropertyExpressionTest extends BaseExpressionTest { public void sqlExpression() { TDSpiExpressionRequest request = new TDSpiExpressionRequest(null); exp("a", "b", 10).addSql(request); - assertThat(request.getSql()).isEqualTo(" ? between a and b "); + assertThat(request.getSql()).isEqualTo(" ? between a and b"); } @Test diff --git a/src/test/java/io/ebeaninternal/server/expression/InRangeExpressionTest.java b/src/test/java/io/ebeaninternal/server/expression/InRangeExpressionTest.java index 44ee53eb4..759ac0fc1 100644 --- a/src/test/java/io/ebeaninternal/server/expression/InRangeExpressionTest.java +++ b/src/test/java/io/ebeaninternal/server/expression/InRangeExpressionTest.java @@ -15,7 +15,7 @@ public class InRangeExpressionTest extends BaseExpressionTest { InRangeExpression exp = new InRangeExpression("startDate", 1, 2); exp.addSql(expReq); - assertThat(expReq.getSql()).isEqualTo("(startDate >= ? and startDate < ?) "); + assertThat(expReq.getSql()).isEqualTo("(startDate >= ? and startDate < ?)"); } @Test diff --git a/src/test/java/io/ebeaninternal/server/expression/LogicExpressionTest.java b/src/test/java/io/ebeaninternal/server/expression/LogicExpressionTest.java index 8e2fbea0f..601c607c6 100644 --- a/src/test/java/io/ebeaninternal/server/expression/LogicExpressionTest.java +++ b/src/test/java/io/ebeaninternal/server/expression/LogicExpressionTest.java @@ -21,6 +21,17 @@ public class LogicExpressionTest extends BaseExpressionTest { return new LogicExpression.Or(a, b); } + @Test + public void addSql() { + + DefaultExpressionRequest expReq = newExpressionRequest(); + + LogicExpression and = and(eq("a", 10), eq("b", 10)); + and.addSql(expReq); + + assertThat(expReq.getSql()).isEqualTo("(a = ? and b = ?)"); + } + @Test public void isSameByPlan_when_same() { diff --git a/src/test/java/io/ebeaninternal/server/expression/NoopExpressionTest.java b/src/test/java/io/ebeaninternal/server/expression/NoopExpressionTest.java index 463d9e2fc..a6bac3e9a 100644 --- a/src/test/java/io/ebeaninternal/server/expression/NoopExpressionTest.java +++ b/src/test/java/io/ebeaninternal/server/expression/NoopExpressionTest.java @@ -48,7 +48,7 @@ public class NoopExpressionTest extends BaseExpressionTest { query.findList(); String generatedSql = sqlOf(query); - assertThat(generatedSql).contains("select t0.id from o_customer t0 where t0.name is null and 1=1 and t0.status is not null"); + assertThat(generatedSql).contains("select t0.id from o_customer t0 where t0.name is null and 1=1 and t0.status is not null"); } @Test diff --git a/src/test/java/io/ebeaninternal/server/expression/NullExpressionTest.java b/src/test/java/io/ebeaninternal/server/expression/NullExpressionTest.java index 01f35797b..02c47948f 100644 --- a/src/test/java/io/ebeaninternal/server/expression/NullExpressionTest.java +++ b/src/test/java/io/ebeaninternal/server/expression/NullExpressionTest.java @@ -2,8 +2,8 @@ package io.ebeaninternal.server.expression; import io.ebeaninternal.api.ManyWhereJoins; import io.ebeaninternal.api.SpiExpression; -import org.tests.model.basic.Order; import org.junit.Test; +import org.tests.model.basic.Order; import static org.assertj.core.api.Assertions.assertThat; @@ -22,7 +22,7 @@ public class NullExpressionTest extends BaseExpressionTest { nullExp("id", true).addSql(expReq); - assertThat(expReq.getSql()).isEqualTo("id is not null "); + assertThat(expReq.getSql()).isEqualTo("id is not null"); } @Test @@ -32,7 +32,7 @@ public class NullExpressionTest extends BaseExpressionTest { nullExp("id", false).addSql(expReq); - assertThat(expReq.getSql()).isEqualTo("id is null "); + assertThat(expReq.getSql()).isEqualTo("id is null"); } @Test @@ -42,7 +42,7 @@ public class NullExpressionTest extends BaseExpressionTest { nullExp("customer", true).addSql(expReq); - assertThat(expReq.getSql()).isEqualTo("customer.id is not null "); + assertThat(expReq.getSql()).isEqualTo("customer.id is not null"); } @Test @@ -52,7 +52,7 @@ public class NullExpressionTest extends BaseExpressionTest { nullExp("customer", false).addSql(expReq); - assertThat(expReq.getSql()).isEqualTo("customer.id is null "); + assertThat(expReq.getSql()).isEqualTo("customer.id is null"); } @Test diff --git a/src/test/java/io/ebeaninternal/server/expression/platform/HanaDbExpressionTest.java b/src/test/java/io/ebeaninternal/server/expression/platform/HanaDbExpressionTest.java index c2d47bea2..c367ba601 100644 --- a/src/test/java/io/ebeaninternal/server/expression/platform/HanaDbExpressionTest.java +++ b/src/test/java/io/ebeaninternal/server/expression/platform/HanaDbExpressionTest.java @@ -64,6 +64,6 @@ public class HanaDbExpressionTest { public void testJson() { SpiExpressionRequest request = new DefaultExpressionRequest(null); expression.json(request, "jsonproperty", "path", Op.EQ, "val"); - assertEquals("json_value(jsonproperty, '$.path') = ? ", request.getSql()); + assertEquals("json_value(jsonproperty, '$.path') = ?", request.getSql()); } } diff --git a/src/test/java/io/ebeaninternal/server/grammer/EqlParserTest.java b/src/test/java/io/ebeaninternal/server/grammer/EqlParserTest.java index 44febf234..4be7f66f8 100644 --- a/src/test/java/io/ebeaninternal/server/grammer/EqlParserTest.java +++ b/src/test/java/io/ebeaninternal/server/grammer/EqlParserTest.java @@ -82,7 +82,7 @@ public class EqlParserTest extends BaseTestCase { Query query = parse("where name ieq 'Rob'"); query.findList(); - assertThat(query.getGeneratedSql()).contains("where lower(t0.name) =?"); + assertThat(query.getGeneratedSql()).contains("where lower(t0.name) = ?"); } @Test @@ -91,7 +91,7 @@ public class EqlParserTest extends BaseTestCase { Query query = parse("where name ine 'Rob'"); query.findList(); - assertThat(query.getGeneratedSql()).contains("where lower(t0.name) !=?"); + assertThat(query.getGeneratedSql()).contains("where lower(t0.name) != ?"); } @Test @@ -99,7 +99,7 @@ public class EqlParserTest extends BaseTestCase { Query query = parse("where 'Rob' ieq name"); query.findList(); - assertThat(query.getGeneratedSql()).contains("where lower(t0.name) =?"); + assertThat(query.getGeneratedSql()).contains("where lower(t0.name) = ?"); } @Test @@ -108,7 +108,7 @@ public class EqlParserTest extends BaseTestCase { Query query = parse("where 'Rob' ine name"); query.findList(); - assertThat(query.getGeneratedSql()).contains("where lower(t0.name) !=?"); + assertThat(query.getGeneratedSql()).contains("where lower(t0.name) != ?"); } @Test @@ -156,7 +156,7 @@ public class EqlParserTest extends BaseTestCase { Query query = parse("where name = 'Rob' or (status = 'NEW' and smallnote is null)"); query.findList(); - assertThat(query.getGeneratedSql()).contains("where (t0.name = ? or (t0.status = ? and t0.smallnote is null ) )"); + assertThat(query.getGeneratedSql()).contains("where (t0.name = ? or (t0.status = ? and t0.smallnote is null))"); } @Test @@ -176,7 +176,7 @@ public class EqlParserTest extends BaseTestCase { Query query = parse("where (name = 'Rob' or status = 'NEW') and smallnote is null"); query.findList(); - assertThat(query.getGeneratedSql()).contains("where ((t0.name = ? or t0.status = ? ) and t0.smallnote is null )"); + assertThat(query.getGeneratedSql()).contains("where ((t0.name = ? or t0.status = ?) and t0.smallnote is null)"); } @Test @@ -195,15 +195,15 @@ public class EqlParserTest extends BaseTestCase { Query query = parse("where not (name = 'Rob' and status = 'NEW')"); query.findList(); - assertThat(query.getGeneratedSql()).contains("where not (t0.name = ? and t0.status = ? )"); + assertThat(query.getGeneratedSql()).contains("where not (t0.name = ? and t0.status = ?)"); query = parse("where not ((name = 'Rob' and status = 'NEW'))"); query.findList(); - assertThat(query.getGeneratedSql()).contains("where not (t0.name = ? and t0.status = ? )"); + assertThat(query.getGeneratedSql()).contains("where not (t0.name = ? and t0.status = ?)"); query = parse("where not (((name = 'Rob') and (status = 'NEW')))"); query.findList(); - assertThat(query.getGeneratedSql()).contains("where not (t0.name = ? and t0.status = ? )"); + assertThat(query.getGeneratedSql()).contains("where not (t0.name = ? and t0.status = ?)"); } @Test @@ -281,7 +281,7 @@ public class EqlParserTest extends BaseTestCase { Query query = parse("where name inrange 'As' to 'B'"); query.findList(); - assertThat(query.getGeneratedSql()).contains("where (t0.name >= ? and t0.name < ?) "); + assertThat(query.getGeneratedSql()).contains("where (t0.name >= ? and t0.name < ?)"); } @Test @@ -301,7 +301,7 @@ public class EqlParserTest extends BaseTestCase { Query query = parse("where name between 'As' and 'B'"); query.findList(); - assertThat(query.getGeneratedSql()).contains("where t0.name between ? and ? "); + assertThat(query.getGeneratedSql()).contains("where t0.name between ? and ?"); } @Test @@ -312,7 +312,7 @@ public class EqlParserTest extends BaseTestCase { query.setParameter("two", "b"); query.findList(); - assertThat(query.getGeneratedSql()).contains("where t0.name between ? and ? "); + assertThat(query.getGeneratedSql()).contains("where t0.name between ? and ?"); } @Test diff --git a/src/test/java/org/tests/basic/TestOrderTotalAmountReportBean.java b/src/test/java/org/tests/basic/TestOrderTotalAmountReportBean.java index b844cf9bb..80dd89e80 100644 --- a/src/test/java/org/tests/basic/TestOrderTotalAmountReportBean.java +++ b/src/test/java/org/tests/basic/TestOrderTotalAmountReportBean.java @@ -5,10 +5,10 @@ import io.ebean.Ebean; import io.ebean.Query; import io.ebean.RawSql; import io.ebean.RawSqlBuilder; -import org.tests.model.basic.OrderAggregate; -import org.tests.model.basic.ResetBasicData; import org.junit.Assert; import org.junit.Test; +import org.tests.model.basic.OrderAggregate; +import org.tests.model.basic.ResetBasicData; import java.util.List; @@ -128,7 +128,7 @@ public class TestOrderTotalAmountReportBean extends BaseTestCase { .findList(); assertThat(query.getGeneratedSql()).contains("count(*) as total_items, sum(order_qty*unit_price) as total_amount, max(order_qty*unit_price) as maxAmount from o_order_detail"); - assertThat(query.getGeneratedSql()).contains("from o_order_detail where order_id > ? group by order_id having count(*) > ? order by sum(order_qty*unit_price) desc"); + assertThat(query.getGeneratedSql()).contains("from o_order_detail where order_id > ? group by order_id having count(*) > ? order by sum(order_qty*unit_price) desc"); assertNotNull(list); } @@ -147,7 +147,7 @@ public class TestOrderTotalAmountReportBean extends BaseTestCase { .findList(); assertThat(query.getGeneratedSql()).contains("count(*) as totalItems, sum(order_qty*unit_price) as totalAmount, max(order_qty*unit_price) as maxAmount from o_order_detail"); - assertThat(query.getGeneratedSql()).contains("from o_order_detail where id > ? and order_id is not null group by order_id having sum(order_qty*unit_price) < ? order by sum(order_qty*unit_price) desc"); + assertThat(query.getGeneratedSql()).contains("from o_order_detail where id > ? and order_id is not null group by order_id having sum(order_qty*unit_price) < ? order by sum(order_qty*unit_price) desc"); assertNotNull(list); } } diff --git a/src/test/java/org/tests/batchload/TestSecondaryQueries.java b/src/test/java/org/tests/batchload/TestSecondaryQueries.java index 7923656ef..1e0663e59 100644 --- a/src/test/java/org/tests/batchload/TestSecondaryQueries.java +++ b/src/test/java/org/tests/batchload/TestSecondaryQueries.java @@ -149,7 +149,7 @@ public class TestSecondaryQueries extends TransactionalTestCase { String generatedSql = sqlOf(query, 2); //select t0.id c0, t0.status c1, t0.kcustomer_id c2 from o_order t0 where t0.status = ? ; --bind(NEW) - assertEquals("select t0.id, t0.status, t0.kcustomer_id from o_order t0 where t0.status = ? ", generatedSql); + assertEquals("select t0.id, t0.status, t0.kcustomer_id from o_order t0 where t0.status = ?", generatedSql); //List> secondaryQueries = spiQuery.getLoggedSecondaryQueries(); diff --git a/src/test/java/org/tests/model/aggregation/TestAggregationMany.java b/src/test/java/org/tests/model/aggregation/TestAggregationMany.java index bc0aa7ac4..fd77a164c 100644 --- a/src/test/java/org/tests/model/aggregation/TestAggregationMany.java +++ b/src/test/java/org/tests/model/aggregation/TestAggregationMany.java @@ -63,7 +63,7 @@ public class TestAggregationMany extends BaseTestCase { List sql = LoggedSqlCollector.stop(); assertThat(sql).hasSize(1); - assertThat(sql.get(0)).contains("select t0.id, t0.name, t1.name, sum(t1.use_secs), sum(t1.fuel) from dmachine t0 left join d_machine_aux_use t1 on t1.machine_id = t0.id where t0.organisation_id = ? group by t0.id, t0.name, t1.name order by t0.id"); + assertThat(sql.get(0)).contains("select t0.id, t0.name, t1.name, sum(t1.use_secs), sum(t1.fuel) from dmachine t0 left join d_machine_aux_use t1 on t1.machine_id = t0.id where t0.organisation_id = ? group by t0.id, t0.name, t1.name order by t0.id"); } @Test @@ -89,6 +89,6 @@ public class TestAggregationMany extends BaseTestCase { List sql = LoggedSqlCollector.stop(); assertThat(sql).hasSize(1); - assertThat(sql.get(0)).contains("select t0.id, t0.name, sum(t1.use_secs), sum(t1.fuel) from dmachine t0 left join d_machine_aux_use t1 on t1.machine_id = t0.id where t0.organisation_id = ? group by t0.id, t0.name order by t0.id"); + assertThat(sql.get(0)).contains("select t0.id, t0.name, sum(t1.use_secs), sum(t1.fuel) from dmachine t0 left join d_machine_aux_use t1 on t1.machine_id = t0.id where t0.organisation_id = ? group by t0.id, t0.name order by t0.id"); } } diff --git a/src/test/java/org/tests/model/aggregation/TestAggregationTopLevel.java b/src/test/java/org/tests/model/aggregation/TestAggregationTopLevel.java index 7eb72309c..b7dad5e50 100644 --- a/src/test/java/org/tests/model/aggregation/TestAggregationTopLevel.java +++ b/src/test/java/org/tests/model/aggregation/TestAggregationTopLevel.java @@ -43,7 +43,7 @@ public class TestAggregationTopLevel extends BaseTestCase { .query(); List result = query.findList(); - assertThat(sqlOf(query)).contains("select t0.machine_id, t0.date, sum(t0.total_kms), sum(cost) from d_machine_stats t0 where t0.date > ? group by t0.machine_id, t0.date having sum(cost) > ?"); + assertThat(sqlOf(query)).contains("select t0.machine_id, t0.date, sum(t0.total_kms), sum(cost) from d_machine_stats t0 where t0.date > ? group by t0.machine_id, t0.date having sum(cost) > ?"); assertThat(result).isNotEmpty(); } @@ -56,7 +56,7 @@ public class TestAggregationTopLevel extends BaseTestCase { .query(); List result = query.findList(); - assertThat(sqlOf(query)).contains("select t0.machine_id, sum(t0.total_kms), sum(cost) from d_machine_stats t0 where t0.date > ? group by t0.machine_id"); + assertThat(sqlOf(query)).contains("select t0.machine_id, sum(t0.total_kms), sum(cost) from d_machine_stats t0 where t0.date > ? group by t0.machine_id"); assertThat(result).isNotEmpty(); } @@ -70,7 +70,7 @@ public class TestAggregationTopLevel extends BaseTestCase { .query(); List result = query.findList(); - assertThat(sqlOf(query)).contains("select t0.date, sum(t0.total_kms), sum(t0.hours), max(t0.rate), sum(cost), max(t0.total_kms) from d_machine_stats t0 where t0.date > ? group by t0.date having sum(t0.hours) > ?"); + assertThat(sqlOf(query)).contains("select t0.date, sum(t0.total_kms), sum(t0.hours), max(t0.rate), sum(cost), max(t0.total_kms) from d_machine_stats t0 where t0.date > ? group by t0.date having sum(t0.hours) > ?"); assertThat(result).isNotEmpty(); } @@ -84,7 +84,7 @@ public class TestAggregationTopLevel extends BaseTestCase { .query(); List result = query.findList(); - assertThat(sqlOf(query)).contains("select t0.machine_id, t0.date, sum(t0.total_kms), sum(t0.hours) from d_machine_stats t0 where t0.date > ? group by t0.machine_id, t0.date having sum(t0.hours) > ?"); + assertThat(sqlOf(query)).contains("select t0.machine_id, t0.date, sum(t0.total_kms), sum(t0.hours) from d_machine_stats t0 where t0.date > ? group by t0.machine_id, t0.date having sum(t0.hours) > ?"); assertThat(result).isNotEmpty(); } @@ -98,7 +98,7 @@ public class TestAggregationTopLevel extends BaseTestCase { .query(); List result = query.findList(); - assertThat(sqlOf(query)).contains("select t0.machine_id, sum(t0.total_kms) from d_machine_stats t0 where t0.date > ? group by t0.machine_id having sum(t0.hours) > ?"); + assertThat(sqlOf(query)).contains("select t0.machine_id, sum(t0.total_kms) from d_machine_stats t0 where t0.date > ? group by t0.machine_id having sum(t0.hours) > ?"); assertThat(result).isNotEmpty(); } @@ -119,7 +119,7 @@ public class TestAggregationTopLevel extends BaseTestCase { List sql = LoggedSqlCollector.stop(); assertThat(sql).hasSize(1); - assertThat(sql.get(0)).contains("select sum(t0.total_kms), sum(t0.hours), t1.id, t1.name from d_machine_stats t0 join dmachine t1 on t1.id = t0.machine_id where t0.date > ? group by t1.id, t1.name having sum(t0.hours) > ?"); + assertThat(sql.get(0)).contains("select sum(t0.total_kms), sum(t0.hours), t1.id, t1.name from d_machine_stats t0 join dmachine t1 on t1.id = t0.machine_id where t0.date > ? group by t1.id, t1.name having sum(t0.hours) > ?"); } @Test @@ -139,7 +139,7 @@ public class TestAggregationTopLevel extends BaseTestCase { List sql = LoggedSqlCollector.stop(); assertThat(sql).hasSize(1); - assertThat(sql.get(0)).contains("select t0.date, sum(t0.total_kms), sum(t0.hours), t1.id, t1.name from d_machine_stats t0 join dmachine t1 on t1.id = t0.machine_id where t0.date > ? group by t0.date, t1.id, t1.name having sum(t0.hours) > ?"); + assertThat(sql.get(0)).contains("select t0.date, sum(t0.total_kms), sum(t0.hours), t1.id, t1.name from d_machine_stats t0 join dmachine t1 on t1.id = t0.machine_id where t0.date > ? group by t0.date, t1.id, t1.name having sum(t0.hours) > ?"); } @@ -161,7 +161,7 @@ public class TestAggregationTopLevel extends BaseTestCase { List sql = LoggedSqlCollector.stop(); assertThat(sql).hasSize(2); - assertThat(sql.get(0)).contains("select sum(t0.total_kms), sum(t0.hours), t0.machine_id from d_machine_stats t0 where t0.date > ? group by t0.machine_id having sum(t0.hours) > ?"); + assertThat(sql.get(0)).contains("select sum(t0.total_kms), sum(t0.hours), t0.machine_id from d_machine_stats t0 where t0.date > ? group by t0.machine_id having sum(t0.hours) > ?"); assertThat(sql.get(1)).contains("select t0.id, t0.name from dmachine t0 where t0.id"); } @@ -183,7 +183,7 @@ public class TestAggregationTopLevel extends BaseTestCase { List sql = LoggedSqlCollector.stop(); assertThat(sql).hasSize(2); - assertThat(sql.get(0)).contains("select t0.date, sum(t0.total_kms), sum(t0.hours), t0.machine_id from d_machine_stats t0 where t0.date > ? group by t0.date, t0.machine_id having sum(t0.hours) > ?"); + assertThat(sql.get(0)).contains("select t0.date, sum(t0.total_kms), sum(t0.hours), t0.machine_id from d_machine_stats t0 where t0.date > ? group by t0.date, t0.machine_id having sum(t0.hours) > ?"); assertThat(sql.get(1)).contains("select t0.id, t0.name from dmachine t0 where t0.id"); } @@ -196,7 +196,7 @@ public class TestAggregationTopLevel extends BaseTestCase { .query(); List result = query.findList(); - assertThat(sqlOf(query)).contains("select t0.machine_id, t0.date, max(t0.rate) from d_machine_stats t0 where t0.date > ? group by t0.machine_id, t0.date"); + assertThat(sqlOf(query)).contains("select t0.machine_id, t0.date, max(t0.rate) from d_machine_stats t0 where t0.date > ? group by t0.machine_id, t0.date"); assertThat(result).isNotEmpty(); } @@ -218,7 +218,7 @@ public class TestAggregationTopLevel extends BaseTestCase { List sql = LoggedSqlCollector.stop(); assertThat(sql).hasSize(1); - assertThat(sqlOf(query)).contains("select t0.id, t0.name, sum(t1.total_kms) from dmachine t0 left join d_machine_stats t1 on t1.machine_id = t0.id where t0.name = ? group by t0.id, t0.name order by t0.id"); + assertThat(sqlOf(query)).contains("select t0.id, t0.name, sum(t1.total_kms) from dmachine t0 left join d_machine_stats t1 on t1.machine_id = t0.id where t0.name = ? group by t0.id, t0.name order by t0.id"); } @Test @@ -244,7 +244,7 @@ public class TestAggregationTopLevel extends BaseTestCase { List sql = LoggedSqlCollector.stop(); assertThat(sql).hasSize(1); - assertThat(sqlOf(query)).contains("select t0.id, t0.name, t1.date, max(t1.rate), sum(t1.total_kms) from dmachine t0 left join d_machine_stats t1 on t1.machine_id = t0.id where t0.name = ? group by t0.id, t0.name, t1.date order by t0.id"); + assertThat(sqlOf(query)).contains("select t0.id, t0.name, t1.date, max(t1.rate), sum(t1.total_kms) from dmachine t0 left join d_machine_stats t1 on t1.machine_id = t0.id where t0.name = ? group by t0.id, t0.name, t1.date order by t0.id"); } diff --git a/src/test/java/org/tests/model/basic/cache/TestCacheViaComplexNaturalKey.java b/src/test/java/org/tests/model/basic/cache/TestCacheViaComplexNaturalKey.java index 7113db45a..d1a95de0b 100644 --- a/src/test/java/org/tests/model/basic/cache/TestCacheViaComplexNaturalKey.java +++ b/src/test/java/org/tests/model/basic/cache/TestCacheViaComplexNaturalKey.java @@ -108,7 +108,7 @@ public class TestCacheViaComplexNaturalKey extends BaseTestCase { assertThat(sql).hasSize(1); if (isH2()) { // in clause with only 1 bind param - (sku=3 ... we got hits on sku 1 and 2) - assertThat(sql.get(0)).contains("from o_cached_natkey t0 where t0.store = ? and t0.sku in (? ) order by t0.sku desc; --bind(abc,Array[1]={3})"); + assertThat(sql.get(0)).contains("from o_cached_natkey t0 where t0.store = ? and t0.sku in (? ) order by t0.sku desc; --bind(abc,Array[1]={3})"); } assertThat(list).hasSize(3); @@ -169,7 +169,7 @@ public class TestCacheViaComplexNaturalKey extends BaseTestCase { assertThat(sql).hasSize(1); if (isH2()) { // in clause with 2 bind params as we got not hits on the cache - assertThat(sql.get(0)).contains("from o_cached_natkey t0 where t0.store = ? and t0.sku in (?, ? ) order by t0.sku desc; --bind(abc,Array[2]={3,4})"); + assertThat(sql.get(0)).contains("from o_cached_natkey t0 where t0.store = ? and t0.sku in (?, ? ) order by t0.sku desc; --bind(abc,Array[2]={3,4})"); } assertThat(list).hasSize(2); diff --git a/src/test/java/org/tests/model/basic/cache/TestCacheViaComplexNaturalKey3.java b/src/test/java/org/tests/model/basic/cache/TestCacheViaComplexNaturalKey3.java index b8b0b20e5..256c730e6 100644 --- a/src/test/java/org/tests/model/basic/cache/TestCacheViaComplexNaturalKey3.java +++ b/src/test/java/org/tests/model/basic/cache/TestCacheViaComplexNaturalKey3.java @@ -116,7 +116,7 @@ public class TestCacheViaComplexNaturalKey3 extends BaseTestCase { assertThat(sql).hasSize(1); if (isH2()) { // in clause with only 1 bind param - (sku=3 ... we got hits on sku 1 and 2) - assertThat(sql.get(0)).contains("from o_cached_natkey3 t0 where t0.store = ? and t0.code in (? ) and t0.sku = ? order by t0.sku desc, t0.code; --bind(def,Array[1]={1000},2)"); + assertThat(sql.get(0)).contains("from o_cached_natkey3 t0 where t0.store = ? and t0.code in (? ) and t0.sku = ? order by t0.sku desc, t0.code; --bind(def,Array[1]={1000},2)"); } assertThat(list).hasSize(4); @@ -178,7 +178,7 @@ public class TestCacheViaComplexNaturalKey3 extends BaseTestCase { assertThat(sql).hasSize(1); if (isH2()) { // in clause with 2 bind params as we got not hits on the cache - assertThat(sql.get(0)).contains("from o_cached_natkey3 t0 where t0.store = ? and t0.sku in (?, ?, ? ) and t0.code = ? order by t0.sku desc; --bind(abc,Array[3]={3,2,4},1001)"); + assertThat(sql.get(0)).contains("from o_cached_natkey3 t0 where t0.store = ? and t0.sku in (?, ?, ? ) and t0.code = ? order by t0.sku desc; --bind(abc,Array[3]={3,2,4},1001)"); } assertThat(list).hasSize(2); @@ -278,13 +278,13 @@ public class TestCacheViaComplexNaturalKey3 extends BaseTestCase { assertBeanCacheHitMiss(1, 0); if (isH2()) { - assertThat(sql.get(0)).contains("from o_cached_natkey3 t0 where t0.store = ? and concat(t0.sku,'-',t0.code) in (?, ? ) order by t0.sku desc; --bind(def,Array[2]={2-1000,3-1000})"); + assertThat(sql.get(0)).contains("from o_cached_natkey3 t0 where t0.store = ? and concat(t0.sku,'-',t0.code) in (?, ? ) order by t0.sku desc; --bind(def,Array[2]={2-1000,3-1000})"); } else if (isPostgres()) { - assertThat(sql.get(0)).contains("from o_cached_natkey3 t0 where t0.store = ? and (t0.sku||'-'||t0.code)"); + assertThat(sql.get(0)).contains("from o_cached_natkey3 t0 where t0.store = ? and (t0.sku||'-'||t0.code)"); } else if (isHana()) { - assertThat(sql.get(0)).contains("from o_cached_natkey3 t0 where t0.store = ? and concat(t0.sku, '-'||t0.code)"); + assertThat(sql.get(0)).contains("from o_cached_natkey3 t0 where t0.store = ? and concat(t0.sku, '-'||t0.code)"); } else { - assertThat(sql.get(0)).contains("from o_cached_natkey3 t0 where t0.store = ? and concat(t0.sku,'-',t0.code)"); + assertThat(sql.get(0)).contains("from o_cached_natkey3 t0 where t0.store = ? and concat(t0.sku,'-',t0.code)"); } } @@ -321,13 +321,13 @@ public class TestCacheViaComplexNaturalKey3 extends BaseTestCase { assertBeanCacheHitMiss(1, 0); if (isH2()) { - assertThat(sql.get(0)).contains("from o_cached_natkey3 t0 where t0.store = ? and concat(t0.sku,':',t0.code,'-foo') in (?, ? ) order by t0.sku desc; --bind(def,Array[2]={2:1000-foo,3:1000-foo})"); + assertThat(sql.get(0)).contains("from o_cached_natkey3 t0 where t0.store = ? and concat(t0.sku,':',t0.code,'-foo') in (?, ? ) order by t0.sku desc; --bind(def,Array[2]={2:1000-foo,3:1000-foo})"); } else if (isPostgres()){ - assertThat(sql.get(0)).contains("from o_cached_natkey3 t0 where t0.store = ? and (t0.sku||':'||t0.code||'-foo')"); + assertThat(sql.get(0)).contains("from o_cached_natkey3 t0 where t0.store = ? and (t0.sku||':'||t0.code||'-foo')"); } else if (isHana()){ - assertThat(sql.get(0)).contains("from o_cached_natkey3 t0 where t0.store = ? and concat(t0.sku, ':'||t0.code||'-foo')"); + assertThat(sql.get(0)).contains("from o_cached_natkey3 t0 where t0.store = ? and concat(t0.sku, ':'||t0.code||'-foo')"); } else { - assertThat(sql.get(0)).contains("from o_cached_natkey3 t0 where t0.store = ? and concat(t0.sku,':',t0.code,'-foo')"); + assertThat(sql.get(0)).contains("from o_cached_natkey3 t0 where t0.store = ? and concat(t0.sku,':',t0.code,'-foo')"); } } diff --git a/src/test/java/org/tests/model/inheritmany/TestMediaInheritanceJoinToMany.java b/src/test/java/org/tests/model/inheritmany/TestMediaInheritanceJoinToMany.java index f34471dc3..12c8fabc5 100644 --- a/src/test/java/org/tests/model/inheritmany/TestMediaInheritanceJoinToMany.java +++ b/src/test/java/org/tests/model/inheritmany/TestMediaInheritanceJoinToMany.java @@ -38,7 +38,7 @@ public class TestMediaInheritanceJoinToMany extends BaseTestCase { String generatedSql = query.getGeneratedSql(); assertThat(generatedSql).contains("from mprofile t0 left join mmedia t1 on t1.id = t0.picture_id and t1.type = 'Picture' "); - assertThat(generatedSql).contains("where t0.name = ? "); + assertThat(generatedSql).contains("where t0.name = ?"); } diff --git a/src/test/java/org/tests/model/pview/TestPview.java b/src/test/java/org/tests/model/pview/TestPview.java index 2b9f55b1f..deceae812 100644 --- a/src/test/java/org/tests/model/pview/TestPview.java +++ b/src/test/java/org/tests/model/pview/TestPview.java @@ -23,7 +23,7 @@ public class TestPview extends BaseTestCase { query.findList(); String generatedSql = sqlOf(query, 1); - assertThat(generatedSql).contains("select distinct t0.amount, t1.value from paggview t0 join pp u1 on u1.id = t0.pview_id join pp_to_ww u2z_ on u2z_.pp_id = u1.id join wview u2 on u2.id = u2z_.ww_id left join pp t1 on t1.id = t0.pview_id where u2.id = ? order by t1.value"); + assertThat(generatedSql).contains("select distinct t0.amount, t1.value from paggview t0 join pp u1 on u1.id = t0.pview_id join pp_to_ww u2z_ on u2z_.pp_id = u1.id join wview u2 on u2.id = u2z_.ww_id left join pp t1 on t1.id = t0.pview_id where u2.id = ? order by t1.value"); } diff --git a/src/test/java/org/tests/model/view/TestViewBaseEntity.java b/src/test/java/org/tests/model/view/TestViewBaseEntity.java index a0560ff98..b42c1f8e2 100644 --- a/src/test/java/org/tests/model/view/TestViewBaseEntity.java +++ b/src/test/java/org/tests/model/view/TestViewBaseEntity.java @@ -25,7 +25,7 @@ public class TestViewBaseEntity extends BaseTestCase { List list = query.findList(); - assertThat(sqlOf(query, 3)).contains("select t0.order_id, t0.order_total, t0.ship_total, t0.order_id from order_agg_vw t0 where t0.order_total > ? "); + assertThat(sqlOf(query, 3)).contains("select t0.order_id, t0.order_total, t0.ship_total, t0.order_id from order_agg_vw t0 where t0.order_total > ?"); assertThat(list).isNotEmpty(); } diff --git a/src/test/java/org/tests/query/TestExprNestedDisjunction.java b/src/test/java/org/tests/query/TestExprNestedDisjunction.java index 02125bc64..fa9679506 100644 --- a/src/test/java/org/tests/query/TestExprNestedDisjunction.java +++ b/src/test/java/org/tests/query/TestExprNestedDisjunction.java @@ -3,9 +3,9 @@ package org.tests.query; import io.ebean.BaseTestCase; import io.ebean.Ebean; import io.ebean.Query; +import org.junit.Test; import org.tests.model.basic.Customer; import org.tests.model.basic.ResetBasicData; -import org.junit.Test; import static org.assertj.core.api.Assertions.assertThat; @@ -28,7 +28,7 @@ public class TestExprNestedDisjunction extends BaseTestCase { String s = q.getGeneratedSql(); assertThat(s).contains("(t0.name like "); - assertThat(s).contains(" and t0.anniversary = ? ) or (t0.status = ? and t0.id > ? )"); + assertThat(s).contains(" and t0.anniversary = ?) or (t0.status = ? and t0.id > ?)"); } @@ -52,7 +52,7 @@ public class TestExprNestedDisjunction extends BaseTestCase { String s = q.getGeneratedSql(); assertThat(s).contains("(t0.name like "); - assertThat(s).contains(" and t0.anniversary = ? ) or (t0.status = ? and t0.id > ? )"); + assertThat(s).contains(" and t0.anniversary = ?) or (t0.status = ? and t0.id > ?)"); } @Test @@ -73,7 +73,7 @@ public class TestExprNestedDisjunction extends BaseTestCase { q.findList(); String s = q.getGeneratedSql(); - assertThat(s).contains("where not (t0.id > ? and t0.anniversary = ? ) order by t0.name"); + assertThat(s).contains("where not (t0.id > ? and t0.anniversary = ?) order by t0.name"); } @Test @@ -95,7 +95,7 @@ public class TestExprNestedDisjunction extends BaseTestCase { q.findList(); String s = q.getGeneratedSql(); - assertThat(s).contains("where (t0.status = ? or not (t0.id > ? and t0.anniversary = ? ) )"); + assertThat(s).contains("where (t0.status = ? or not (t0.id > ? and t0.anniversary = ?))"); } @Test @@ -119,6 +119,6 @@ public class TestExprNestedDisjunction extends BaseTestCase { q.findList(); String s = q.getGeneratedSql(); - assertThat(s).contains("where (t0.status = ? or not (t0.id > ? and t0.anniversary = ? ) )"); + assertThat(s).contains("where (t0.status = ? or not (t0.id > ? and t0.anniversary = ?))"); } } diff --git a/src/test/java/org/tests/query/TestImplicitJoinOnParentRelationship.java b/src/test/java/org/tests/query/TestImplicitJoinOnParentRelationship.java index 92faa6f94..5e50b7b70 100644 --- a/src/test/java/org/tests/query/TestImplicitJoinOnParentRelationship.java +++ b/src/test/java/org/tests/query/TestImplicitJoinOnParentRelationship.java @@ -28,7 +28,7 @@ public class TestImplicitJoinOnParentRelationship extends BaseTestCase { assertThat(sqlOf(query, 1)).contains(expectedSql); } else { - String expectedSql = "select distinct t0.id, t0.name from o_customer t0 join o_order u1 on u1.kcustomer_id = t0.id join o_order_detail u2 on u2.order_id = u1.id join o_product u3 on u3.id = u2.product_id where u3.name = ? "; + String expectedSql = "select distinct t0.id, t0.name from o_customer t0 join o_order u1 on u1.kcustomer_id = t0.id join o_order_detail u2 on u2.order_id = u1.id join o_product u3 on u3.id = u2.product_id where u3.name = ?"; assertThat(sqlOf(query, 1)).contains(expectedSql); } @@ -58,7 +58,7 @@ public class TestImplicitJoinOnParentRelationship extends BaseTestCase { String expectedSql = "select distinct on (t0.id) t0.id, t0.name from o_customer t0 left join o_order u1 on u1.kcustomer_id = t0.id left join o_order_detail u2 on u2.order_id = u1.id left join o_product u3 on u3.id = u2.product_id where (u3.name = ? or t0.id = ? ) "; assertThat(sqlOf(query, 1)).contains(expectedSql); } else { - String expectedSql = "select distinct t0.id, t0.name from o_customer t0 left join o_order u1 on u1.kcustomer_id = t0.id left join o_order_detail u2 on u2.order_id = u1.id left join o_product u3 on u3.id = u2.product_id where (u3.name = ? or t0.id = ? ) "; + String expectedSql = "select distinct t0.id, t0.name from o_customer t0 left join o_order u1 on u1.kcustomer_id = t0.id left join o_order_detail u2 on u2.order_id = u1.id left join o_product u3 on u3.id = u2.product_id where (u3.name = ? or t0.id = ?)"; assertThat(sqlOf(query, 1)).contains(expectedSql); } } @@ -80,7 +80,7 @@ public class TestImplicitJoinOnParentRelationship extends BaseTestCase { assertThat(sqlOf(query, 1)).contains(expectedSql); } else { - String expectedSql = "select distinct t0.id, t0.name from o_customer t0 left join o_order u1 on u1.kcustomer_id = t0.id left join o_order_detail u2 on u2.order_id = u1.id left join o_product u3 on u3.id = u2.product_id where (u3.name = ? or t0.id = ? ) "; + String expectedSql = "select distinct t0.id, t0.name from o_customer t0 left join o_order u1 on u1.kcustomer_id = t0.id left join o_order_detail u2 on u2.order_id = u1.id left join o_product u3 on u3.id = u2.product_id where (u3.name = ? or t0.id = ?)"; assertThat(sqlOf(query, 1)).contains(expectedSql); } } diff --git a/src/test/java/org/tests/query/TestQueryExists.java b/src/test/java/org/tests/query/TestQueryExists.java index 84aac4fb6..5d887034b 100644 --- a/src/test/java/org/tests/query/TestQueryExists.java +++ b/src/test/java/org/tests/query/TestQueryExists.java @@ -28,7 +28,7 @@ public class TestQueryExists extends BaseTestCase { String sql = sqlOf(query); if (isH2() || isPostgres()) { - assertThat(sql).contains("select t0.id from o_order t0 where t0.id > ? limit 1"); + assertThat(sql).contains("select t0.id from o_order t0 where t0.id > ? limit 1"); } assertThat(Ebean.find(Order.class).where().gt("id", 1).exists()).isTrue(); diff --git a/src/test/java/org/tests/query/TestQueryFilterMany.java b/src/test/java/org/tests/query/TestQueryFilterMany.java index 17d40a5ad..448bcd173 100644 --- a/src/test/java/org/tests/query/TestQueryFilterMany.java +++ b/src/test/java/org/tests/query/TestQueryFilterMany.java @@ -154,7 +154,7 @@ public class TestQueryFilterMany extends BaseTestCase { List sql = LoggedSqlCollector.stop(); assertEquals(2, sql.size()); - assertThat(sql.get(1)).contains("and (t0.status = ? or t0.order_date = ?"); + assertThat(sql.get(1)).contains("and (t0.status = ? or t0.order_date = ?"); } @Test diff --git a/src/test/java/org/tests/query/aggregation/TestAggregationCount.java b/src/test/java/org/tests/query/aggregation/TestAggregationCount.java index 65231e8d1..3e88ac43a 100644 --- a/src/test/java/org/tests/query/aggregation/TestAggregationCount.java +++ b/src/test/java/org/tests/query/aggregation/TestAggregationCount.java @@ -95,7 +95,7 @@ public class TestAggregationCount extends BaseTestCase { assertThat(sql).contains("select t0.id, t0.name, count(u1.id), sum(u1.units), sum(u1.units * u1.amount) from tevent_one t0"); assertThat(sql).contains("from tevent_one t0 join tevent_many u1 on u1.event_id = t0.id "); assertThat(sql).contains("where u1.description like "); - assertThat(sql).contains(" group by t0.id, t0.name having count(u1.id) >= ? order by t0.name"); + assertThat(sql).contains(" group by t0.id, t0.name having count(u1.id) >= ? order by t0.name"); // invoke lazy loading Long version = list.get(0).getVersion(); @@ -169,7 +169,7 @@ public class TestAggregationCount extends BaseTestCase { .orderBy().asc("name"); query1.findList(); - assertThat(query1.getGeneratedSql()).contains("having count(u1.id) >= ? order by t0.name"); + assertThat(query1.getGeneratedSql()).contains("having count(u1.id) >= ? order by t0.name"); } @Test @@ -391,7 +391,7 @@ public class TestAggregationCount extends BaseTestCase { assertThat(names).isNotEmpty(); List sql = LoggedSqlCollector.stop(); - assertThat(trimSql(sql.get(0))).contains("select " + concat("t0.last_name",", ","t0.first_name") + " from contact t0 where t0.phone is null order by t0.last_name"); + assertThat(trimSql(sql.get(0))).contains("select " + concat("t0.last_name",", ","t0.first_name") + " from contact t0 where t0.phone is null order by t0.last_name"); } @Test @@ -459,7 +459,7 @@ public class TestAggregationCount extends BaseTestCase { } List sql = LoggedSqlCollector.stop(); - assertThat(trimSql(sql.get(0))).contains("select t0.id, t0.email, " + concat("t0.last_name",", ","t0.first_name") + " lastName from contact t0 where t0.phone is null order by t0.last_name; --bind()"); + assertThat(trimSql(sql.get(0))).contains("select t0.id, t0.email, " + concat("t0.last_name",", ","t0.first_name") + " lastName from contact t0 where t0.phone is null order by t0.last_name; --bind()"); } } diff --git a/src/test/java/org/tests/query/joins/TestDisjunctWhereOuterJoin.java b/src/test/java/org/tests/query/joins/TestDisjunctWhereOuterJoin.java index 0610c7fa6..28b8b0dbd 100644 --- a/src/test/java/org/tests/query/joins/TestDisjunctWhereOuterJoin.java +++ b/src/test/java/org/tests/query/joins/TestDisjunctWhereOuterJoin.java @@ -79,7 +79,7 @@ public class TestDisjunctWhereOuterJoin extends BaseTestCase { String sql = sqlOf(query); assertSqlOuterJoins(sql); - assertThat(sql).contains("where (t0.user_name = ? or u1.roleid = ? )"); + assertThat(sql).contains("where (t0.user_name = ? or u1.roleid = ?)"); } private void queryOrExpression(Integer roleid) { @@ -95,7 +95,7 @@ public class TestDisjunctWhereOuterJoin extends BaseTestCase { String sql = sqlOf(query); assertSqlOuterJoins(sql); - assertThat(sql).contains("where (t0.user_name = ? or u1.roleid = ? )"); + assertThat(sql).contains("where (t0.user_name = ? or u1.roleid = ?)"); } private void assertSqlOuterJoins(String sql) { diff --git a/src/test/java/org/tests/query/joins/TestDisjunctWhereOuterOnMany.java b/src/test/java/org/tests/query/joins/TestDisjunctWhereOuterOnMany.java index cb7c6522d..435a3de55 100644 --- a/src/test/java/org/tests/query/joins/TestDisjunctWhereOuterOnMany.java +++ b/src/test/java/org/tests/query/joins/TestDisjunctWhereOuterOnMany.java @@ -62,7 +62,7 @@ public class TestDisjunctWhereOuterOnMany extends BaseTestCase { assertThat(sqlOf(query, 1)).contains(expectedSql); } else { - String expectedSql = "select distinct t0.id, t0.name, t0.description, t0.version from uuone t0 left join uutwo u1 on u1.master_id = t0.id where (t0.name = ? or u1.name = ? ) "; + String expectedSql = "select distinct t0.id, t0.name, t0.description, t0.version from uuone t0 left join uutwo u1 on u1.master_id = t0.id where (t0.name = ? or u1.name = ?)"; assertThat(sqlOf(query, 1)).contains(expectedSql); } diff --git a/src/test/java/org/tests/query/other/TestQueryConversationRowCount.java b/src/test/java/org/tests/query/other/TestQueryConversationRowCount.java index 455e92e71..81635a944 100644 --- a/src/test/java/org/tests/query/other/TestQueryConversationRowCount.java +++ b/src/test/java/org/tests/query/other/TestQueryConversationRowCount.java @@ -3,10 +3,10 @@ package org.tests.query.other; import io.ebean.BaseTestCase; import io.ebean.Ebean; import io.ebean.Query; -import org.tests.model.converstation.Conversation; import org.ebeantest.LoggedSqlCollector; import org.junit.Assert; import org.junit.Test; +import org.tests.model.converstation.Conversation; import java.util.List; @@ -49,7 +49,7 @@ public class TestQueryConversationRowCount extends BaseTestCase { assertThat(generatedSql).contains("select distinct t0.id, t0.title, t0.isopen"); } assertThat(generatedSql).contains("left join c_participation u1 on u1.conversation_id = t0.id"); - assertThat(generatedSql).contains("where t0.group_id = ? and ((t0.isopen = ? and u1.user_id = ? ) or t0.isopen = ? )"); + assertThat(generatedSql).contains("where t0.group_id = ? and ((t0.isopen = ? and u1.user_id = ?) or t0.isopen = ?)"); LoggedSqlCollector.start(); @@ -66,7 +66,7 @@ public class TestQueryConversationRowCount extends BaseTestCase { Assert.assertEquals(1, loggedSql.size()); String countSql = trimSql(loggedSql.get(0), 0); - assertThat(countSql).contains("select count(*) from ( select distinct t0.id from c_conversation t0 left join c_participation u1 on u1.conversation_id = t0.id where t0.group_id = ? and ((t0.isopen = ? and u1.user_id = ? ) or t0.isopen = ? )"); + assertThat(countSql).contains("select count(*) from ( select distinct t0.id from c_conversation t0 left join c_participation u1 on u1.conversation_id = t0.id where t0.group_id = ? and ((t0.isopen = ? and u1.user_id = ?) or t0.isopen = ?))"); } } diff --git a/src/test/java/org/tests/query/other/TestQueryRowCountWithMany.java b/src/test/java/org/tests/query/other/TestQueryRowCountWithMany.java index 019876280..bf9283d50 100644 --- a/src/test/java/org/tests/query/other/TestQueryRowCountWithMany.java +++ b/src/test/java/org/tests/query/other/TestQueryRowCountWithMany.java @@ -3,11 +3,11 @@ package org.tests.query.other; import io.ebean.BaseTestCase; import io.ebean.Ebean; import io.ebean.Query; -import org.tests.model.basic.Order; -import org.tests.model.basic.ResetBasicData; import org.ebeantest.LoggedSqlCollector; import org.junit.Assert; import org.junit.Test; +import org.tests.model.basic.Order; +import org.tests.model.basic.ResetBasicData; import java.util.List; @@ -69,7 +69,7 @@ public class TestQueryRowCountWithMany extends BaseTestCase { Assert.assertEquals(list.size(), rowCount); Assert.assertEquals(2, sqlLogged.size()); assertThat(trimSql(sqlLogged.get(1), 1)).contains( - "select count(*) from ( select distinct t0.id from o_order t0 join o_order_detail u1 on u1.order_id = t0.id where u1.product_id = ? )"); + "select count(*) from ( select distinct t0.id from o_order t0 join o_order_detail u1 on u1.order_id = t0.id where u1.product_id = ?)"); } @@ -94,7 +94,7 @@ public class TestQueryRowCountWithMany extends BaseTestCase { List sqlLogged = LoggedSqlCollector.stop(); Assert.assertEquals(1, sqlLogged.size()); - assertThat(trimSql(sqlLogged.get(0), 1)).contains("select count(*) from ( select distinct t0.id from o_order t0 join o_order_detail u1 on u1.order_id = t0.id where u1.product_id = ? )"); + assertThat(trimSql(sqlLogged.get(0), 1)).contains("select count(*) from ( select distinct t0.id from o_order t0 join o_order_detail u1 on u1.order_id = t0.id where u1.product_id = ?)"); query.findList(); } diff --git a/src/test/java/org/tests/query/other/TestQuerySingleAttribute.java b/src/test/java/org/tests/query/other/TestQuerySingleAttribute.java index 4b5c9ed3c..4e25732bf 100644 --- a/src/test/java/org/tests/query/other/TestQuerySingleAttribute.java +++ b/src/test/java/org/tests/query/other/TestQuerySingleAttribute.java @@ -68,7 +68,7 @@ public class TestQuerySingleAttribute extends BaseTestCase { .orderBy().asc("name"); query.findSingleAttributeList(); - assertThat(sqlOf(query)).contains("select distinct t0.name from o_customer t0 where t0.status = ? order by t0.name"); + assertThat(sqlOf(query)).contains("select distinct t0.name from o_customer t0 where t0.status = ? order by t0.name"); } @Test @@ -140,7 +140,7 @@ public class TestQuerySingleAttribute extends BaseTestCase { List names = query.findSingleAttributeList(); - assertThat(sqlOf(query)).contains("select distinct t0.name from o_customer t0 where t0.status = ? "); + assertThat(sqlOf(query)).contains("select distinct t0.name from o_customer t0 where t0.status = ?"); assertThat(names).isNotNull(); } @@ -158,7 +158,7 @@ public class TestQuerySingleAttribute extends BaseTestCase { List names = query.findSingleAttributeList(); - assertThat(sqlOf(query)).contains("select distinct t0.name from o_customer t0 left join o_address t1 on t1.id = t0.billing_address_id where t0.status = ? and lower(t1.city) like "); + assertThat(sqlOf(query)).contains("select distinct t0.name from o_customer t0 left join o_address t1 on t1.id = t0.billing_address_id where t0.status = ? and lower(t1.city) like "); assertThat(names).isNotNull(); } @@ -406,7 +406,7 @@ public class TestQuerySingleAttribute extends BaseTestCase { assertThat(sqlOf(query)).contains("select distinct t1.billing_address_id from contact t0 " + "join o_customer t1 on t1.id = t0.customer_id " // two spaces! + "left join o_address t2 on t2.id = t1.billing_address_id " - + "where t2.city = ? " + + "where t2.city = ? " + "order by t1.billing_address_id desc"); } @@ -427,7 +427,7 @@ public class TestQuerySingleAttribute extends BaseTestCase { assertThat(sqlOf(query)).contains("select distinct t1.billing_address_id from contact t0 " + "join o_customer t1 on t1.id = t0.customer_id " + "left join o_address t2 on t2.id = t1.billing_address_id " - + "where t2.city = ? " + + "where t2.city = ? " + "order by t1.billing_address_id desc"); } @@ -448,7 +448,7 @@ public class TestQuerySingleAttribute extends BaseTestCase { assertThat(sqlOf(query)).contains("select distinct t1.billing_address_id from contact t0 " + "join o_customer t1 on t1.id = t0.customer_id " + "left join o_address t2 on t2.id = t1.billing_address_id " - + "where t2.city = ? " + + "where t2.city = ? " + "order by t1.billing_address"); } @@ -469,7 +469,7 @@ public class TestQuerySingleAttribute extends BaseTestCase { assertThat(sqlOf(query)).contains("select distinct t1.billing_address_id from contact t0 " + "join o_customer t1 on t1.id = t0.customer_id " + "left join o_address t2 on t2.id = t1.shipping_address_id " - + "where t2.city = ? " + + "where t2.city = ? " + "order by t1.billing_address_id desc"); } @@ -533,7 +533,7 @@ public class TestQuerySingleAttribute extends BaseTestCase { assertThat(sqlOf(query)).contains("select r1.attribute_, count(*) from (" + "select t0.first_name as attribute_ from contact t0 " + "join o_customer t1 on t1.id = t0.customer_id " - + "left join o_address t2 on t2.id = t1.shipping_address_id where t2.line_1 = ? " + + "left join o_address t2 on t2.id = t1.shipping_address_id where t2.line_1 = ?" + ") r1 group by r1.attribute_ order by r1.attribute_"); assertThat(list3.get(0)).isInstanceOf(CountedValue.class); //assertThat(list3.toString()).isEqualTo("[1: Bugs1, 1: Fiona, 1: Fred1, 1: Jim1, 1: Tracy]"); @@ -552,7 +552,7 @@ public class TestQuerySingleAttribute extends BaseTestCase { + "from contact t0 join o_customer t1 on t1.id = t0.customer_id " + "left join o_address t2 on t2.id = t1.billing_address_id " + "left join o_address t3 on t3.id = t1.shipping_address_id " - + "where (t3.line_1 <> ? or t3.line_1 is null ) " + + "where (t3.line_1 <> ? or t3.line_1 is null)" + ") r1 group by r1.attribute_ order by r1.attribute_"); assertThat(list4.get(0)).isInstanceOf(CountedValue.class); //assertThat(list4.toString()).isEqualTo("[1: null, 3: Bos town, 3: P.O.Box 1234]"); @@ -568,7 +568,7 @@ public class TestQuerySingleAttribute extends BaseTestCase { + "select t2.line_1 as attribute_ from contact t0 " + "join o_customer t1 on t1.id = t0.customer_id " + "left join o_address t2 on t2.id = t1.billing_address_id " - + "where t2.line_1 is not null " + + "where t2.line_1 is not null" + ") r1 group by r1.attribute_ order by r1.attribute_ desc "); if (isSqlServer()) { assertThat(sqlOf(query)).endsWith(" fetch next 2 rows only"); diff --git a/src/test/java/org/tests/softdelete/TestSoftDeleteBasic.java b/src/test/java/org/tests/softdelete/TestSoftDeleteBasic.java index 9058195dc..e9557baeb 100644 --- a/src/test/java/org/tests/softdelete/TestSoftDeleteBasic.java +++ b/src/test/java/org/tests/softdelete/TestSoftDeleteBasic.java @@ -79,8 +79,8 @@ public class TestSoftDeleteBasic extends BaseTestCase { List sql = LoggedSqlCollector.stop(); assertThat(sql).hasSize(2); - assertThat(sql.get(0)).contains("from ebasic_sdchild t0 where t0.owner_id = ? and t0.deleted = "); - assertThat(sql.get(1)).contains("from ebasic_sdchild t0 where t0.owner_id = ? and t0.deleted = "); + assertThat(sql.get(0)).contains("from ebasic_sdchild t0 where t0.owner_id = ? and t0.deleted = "); + assertThat(sql.get(1)).contains("from ebasic_sdchild t0 where t0.owner_id = ? and t0.deleted = "); } @Test