Browse Source

Polishing.

Fixes copyright dates of new files to the current year.
Fixes the issue reference to use the GitHub notation.
Adds an additional test to ensure that the `ConstantConditionVisitor` doesn't need a predicate.

Original pull request #978
pull/981/head
Jens Schauder 5 years ago
parent
commit
ec49ba1d3e
No known key found for this signature in database
GPG Key ID: 45CC872F17423DBF
  1. 4
      spring-data-relational/src/main/java/org/springframework/data/relational/core/sql/ConstantCondition.java
  2. 2
      spring-data-relational/src/main/java/org/springframework/data/relational/core/sql/render/ConstantConditionVisitor.java
  3. 13
      spring-data-relational/src/test/java/org/springframework/data/relational/core/sql/render/ConditionRendererUnitTests.java

4
spring-data-relational/src/main/java/org/springframework/data/relational/core/sql/ConstantCondition.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2019-2021 the original author or authors. * Copyright 2021 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -16,7 +16,7 @@
package org.springframework.data.relational.core.sql; package org.springframework.data.relational.core.sql;
/** /**
* {@link Condition} representing fixed sql statement * {@link Condition} representing fixed sql predicate.
* *
* @author Daniele Canteri * @author Daniele Canteri
* @since 2.3 * @since 2.3

2
spring-data-relational/src/main/java/org/springframework/data/relational/core/sql/render/ConstantConditionVisitor.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2019-2021 the original author or authors. * Copyright 2021 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

13
spring-data-relational/src/test/java/org/springframework/data/relational/core/sql/render/ConditionRendererUnitTests.java

@ -22,6 +22,7 @@ import org.junit.jupiter.api.Test;
import org.springframework.data.relational.core.sql.Column; import org.springframework.data.relational.core.sql.Column;
import org.springframework.data.relational.core.sql.Conditions; import org.springframework.data.relational.core.sql.Conditions;
import org.springframework.data.relational.core.sql.Functions; import org.springframework.data.relational.core.sql.Functions;
import org.springframework.data.relational.core.sql.SQL;
import org.springframework.data.relational.core.sql.StatementBuilder; import org.springframework.data.relational.core.sql.StatementBuilder;
import org.springframework.data.relational.core.sql.Table; import org.springframework.data.relational.core.sql.Table;
@ -232,7 +233,7 @@ public class ConditionRendererUnitTests {
assertThat(sql).endsWith("WHERE my_table.left NOT IN (my_table.right)"); assertThat(sql).endsWith("WHERE my_table.left NOT IN (my_table.right)");
} }
@Test // DATAJDBC-907 @Test // #907
public void shouldRenderJust() { public void shouldRenderJust() {
String sql = SqlRenderer.toString(StatementBuilder.select(left).from(table) String sql = SqlRenderer.toString(StatementBuilder.select(left).from(table)
@ -241,4 +242,14 @@ public class ConditionRendererUnitTests {
assertThat(sql).endsWith("WHERE sql"); assertThat(sql).endsWith("WHERE sql");
} }
@Test // #907
public void shouldRenderMultipleJust() {
String sql = SqlRenderer.toString(StatementBuilder.select(left).from(table)
.where( Conditions.just("sql1").and(Conditions.just("sql2")))
.build());
assertThat(sql).endsWith("WHERE sql1 AND sql2");
}
} }

Loading…
Cancel
Save