Skip to content

Commit

Permalink
Polishing.
Browse files Browse the repository at this point in the history
See #1813
  • Loading branch information
schauder committed Sep 24, 2024
1 parent 09ff2d6 commit 89093cf
Showing 1 changed file with 7 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
Expand All @@ -51,14 +50,12 @@
@ExtendWith(SpringExtension.class)
public class ProjectingRepositoryIntegrationTests {

@Autowired
private ImmutableObjectRepository repository;
@Autowired private ImmutableObjectRepository repository;
private JdbcTemplate jdbc;

@Configuration
@EnableR2dbcRepositories(
includeFilters = @ComponentScan.Filter(value = ImmutableObjectRepository.class, type = FilterType.ASSIGNABLE_TYPE),
considerNestedRepositories = true)
@EnableR2dbcRepositories(includeFilters = @ComponentScan.Filter(value = ImmutableObjectRepository.class,
type = FilterType.ASSIGNABLE_TYPE), considerNestedRepositories = true)
static class TestConfiguration extends AbstractR2dbcConfiguration {
@Override
public ConnectionFactory connectionFactory() {
Expand All @@ -74,9 +71,7 @@ void before() {

try {
this.jdbc.execute("DROP TABLE immutable_non_null");
}
catch (DataAccessException e) {
}
} catch (DataAccessException e) {}

this.jdbc.execute("CREATE TABLE immutable_non_null (id serial PRIMARY KEY, name varchar(255), email varchar(255))");
this.jdbc.execute("INSERT INTO immutable_non_null VALUES (42, 'Walter', 'heisenberg@the-white-family.com')");
Expand All @@ -100,8 +95,7 @@ protected ConnectionFactory createConnectionFactory() {
return H2TestSupport.createConnectionFactory();
}

@Test
// GH-1687
@Test // GH-1687
void shouldApplyProjectionDirectly() {

repository.findProjectionByEmail("heisenberg@the-white-family.com") //
Expand All @@ -111,8 +105,7 @@ void shouldApplyProjectionDirectly() {
}).verifyComplete();
}

@Test
// GH-1687
@Test // GH-1687
void shouldApplyEntityQueryProjectionDirectly() {

repository.findAllByEmail("heisenberg@the-white-family.com") //
Expand All @@ -134,8 +127,7 @@ interface ImmutableObjectRepository extends ReactiveCrudRepository<ImmutableNonN
@Table("immutable_non_null")
static class ImmutableNonNullEntity implements Person {

final @Nullable
@Id Integer id;
final @Nullable @Id Integer id;
final String name;
final String email;

Expand Down

0 comments on commit 89093cf

Please # to comment.