DATAJDBC-616 - Migrates to JUnit 5.

MockitoRunner -> MockitoExtension.
SpringRunner, SpringClassRule & SpringMethodRule -> SpringExtension.
This commit is contained in:
Jens Schauder
2020-10-15 10:09:55 +02:00
parent 8fef3d3d7c
commit 9658ac1668
101 changed files with 292 additions and 351 deletions

View File

@@ -32,8 +32,8 @@ import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.springframework.data.annotation.Id;
import org.springframework.data.jdbc.core.convert.DataAccessStrategy;
import org.springframework.data.jdbc.core.convert.JdbcConverter;
@@ -54,7 +54,7 @@ import org.springframework.lang.Nullable;
* @author Jens Schauder
* @author Myeonghyeon-Lee
*/
@Ignore
@Disabled
public class AggregateChangeIdGenerationImmutableUnitTests {
DummyEntity entity = new DummyEntity();

View File

@@ -27,7 +27,7 @@ import java.util.Map;
import java.util.Set;
import org.assertj.core.api.SoftAssertions;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
import org.springframework.data.annotation.Id;

View File

@@ -22,10 +22,9 @@ import lombok.Value;
import lombok.With;
import org.assertj.core.api.SoftAssertions;
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.context.annotation.Bean;
@@ -38,6 +37,7 @@ import org.springframework.data.jdbc.testing.TestConfiguration;
import org.springframework.data.relational.core.mapping.RelationalMappingContext;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import org.springframework.test.context.junit4.rules.SpringClassRule;
import org.springframework.test.context.junit4.rules.SpringMethodRule;
import org.springframework.transaction.annotation.Transactional;
@@ -51,10 +51,9 @@ import org.springframework.transaction.annotation.Transactional;
@ContextConfiguration
@Transactional
@ActiveProfiles("hsql")
@ExtendWith(SpringExtension.class)
public class ImmutableAggregateTemplateHsqlIntegrationTests {
@ClassRule public static final SpringClassRule classRule = new SpringClassRule();
@Rule public SpringMethodRule methodRule = new SpringMethodRule();
@Autowired JdbcAggregateOperations template;
@Test // DATAJDBC-241

View File

@@ -26,7 +26,7 @@ import lombok.With;
import java.util.List;
import org.jetbrains.annotations.NotNull;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.data.annotation.Id;
import org.springframework.data.annotation.Version;
import org.springframework.data.jdbc.core.convert.BasicJdbcConverter;

View File

@@ -23,7 +23,7 @@ import java.util.ArrayList;
import java.util.List;
import org.jetbrains.annotations.NotNull;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.data.annotation.Id;
import org.springframework.data.annotation.Version;
import org.springframework.data.jdbc.core.convert.BasicJdbcConverter;

View File

@@ -37,9 +37,9 @@ import java.util.function.Function;
import java.util.stream.IntStream;
import org.assertj.core.api.SoftAssertions;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.context.annotation.Bean;
@@ -65,6 +65,7 @@ import org.springframework.data.relational.core.mapping.Table;
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcOperations;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestExecutionListeners;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.transaction.annotation.Transactional;
@@ -83,7 +84,7 @@ import org.springframework.transaction.annotation.Transactional;
@ContextConfiguration
@Transactional
@TestExecutionListeners(value = AssumeFeatureRule.class, mergeMode = MERGE_WITH_DEFAULTS)
@RunWith(SpringRunner.class)
@ExtendWith(SpringExtension.class)
public class JdbcAggregateTemplateIntegrationTests {
@Autowired JdbcAggregateOperations template;

View File

@@ -19,9 +19,8 @@ import static org.assertj.core.api.Assertions.*;
import static org.springframework.data.jdbc.testing.TestDatabaseFeatures.Feature.*;
import static org.springframework.test.context.TestExecutionListeners.MergeMode.*;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.context.annotation.Bean;
@@ -38,7 +37,7 @@ import org.springframework.data.relational.core.mapping.RelationalMappingContext
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcOperations;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestExecutionListeners;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import org.springframework.transaction.annotation.Transactional;
/**
@@ -49,7 +48,7 @@ import org.springframework.transaction.annotation.Transactional;
@ContextConfiguration
@Transactional
@TestExecutionListeners(value = AssumeFeatureRule.class, mergeMode = MERGE_WITH_DEFAULTS)
@RunWith(SpringRunner.class)
@ExtendWith(SpringExtension.class)
public class JdbcAggregateTemplateSchemaIntegrationTests {
@Autowired JdbcAggregateOperations template;

View File

@@ -23,12 +23,11 @@ import static org.mockito.Mockito.*;
import lombok.AllArgsConstructor;
import lombok.Data;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
import org.mockito.junit.jupiter.MockitoExtension;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.data.annotation.Id;
import org.springframework.data.domain.PageRequest;
@@ -56,7 +55,7 @@ import org.springframework.data.relational.core.mapping.event.BeforeSaveCallback
* @author Mark Paluch
* @author Milan Milanov
*/
@RunWith(MockitoJUnitRunner.class)
@ExtendWith(MockitoExtension.class)
public class JdbcAggregateTemplateUnitTests {
JdbcAggregateOperations template;
@@ -66,7 +65,7 @@ public class JdbcAggregateTemplateUnitTests {
@Mock RelationResolver relationResolver;
@Mock EntityCallbacks callbacks;
@Before
@BeforeEach
public void setUp() {
RelationalMappingContext mappingContext = new RelationalMappingContext(NamingStrategy.INSTANCE);

View File

@@ -20,7 +20,7 @@ import static org.springframework.data.relational.core.sql.SqlIdentifier.*;
import java.util.List;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.data.annotation.Id;
import org.springframework.data.jdbc.core.mapping.JdbcMappingContext;
import org.springframework.data.mapping.PersistentPropertyPath;

View File

@@ -26,7 +26,7 @@ import java.util.List;
import java.util.UUID;
import org.assertj.core.api.SoftAssertions;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.data.annotation.Id;
import org.springframework.data.jdbc.core.mapping.AggregateReference;

View File

@@ -19,7 +19,7 @@ import static org.assertj.core.api.Assertions.*;
import static org.mockito.Mockito.*;
import org.assertj.core.api.Assertions;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.data.annotation.Id;
import org.springframework.data.jdbc.core.mapping.AggregateReference;

View File

@@ -23,7 +23,7 @@ import junit.framework.AssertionFailedError;
import java.util.Collections;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.data.jdbc.core.convert.FunctionCollector.CombinedDataAccessException;
import org.springframework.data.mapping.PersistentPropertyPath;
import org.springframework.data.relational.core.sql.SqlIdentifier;

View File

@@ -32,8 +32,8 @@ import java.util.HashMap;
import java.util.List;
import org.jetbrains.annotations.NotNull;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.mockito.ArgumentCaptor;
import org.springframework.core.convert.converter.Converter;
import org.springframework.data.annotation.Id;
@@ -75,7 +75,7 @@ public class DefaultDataAccessStrategyUnitTests {
JdbcConverter converter;
DefaultDataAccessStrategy accessStrategy;
@Before
@BeforeEach
public void before() {
DelegatingDataAccessStrategy relationResolver = new DelegatingDataAccessStrategy();

View File

@@ -44,7 +44,7 @@ import java.util.stream.Stream;
import javax.naming.OperationNotSupportedException;
import org.assertj.core.api.SoftAssertions;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.mockito.ArgumentMatchers;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;

View File

@@ -26,7 +26,7 @@ import java.util.Map;
import org.assertj.core.api.Assertions;
import org.assertj.core.api.SoftAssertions;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.data.relational.core.sql.IdentifierProcessing;
import org.springframework.data.relational.core.sql.SqlIdentifier;

View File

@@ -24,7 +24,7 @@ import java.util.List;
import java.util.Map;
import org.assertj.core.api.SoftAssertions;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.core.convert.TypeDescriptor;
/**

View File

@@ -23,7 +23,7 @@ import java.util.List;
import java.util.Map;
import java.util.UUID;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.data.annotation.Id;
import org.springframework.data.jdbc.core.mapping.JdbcMappingContext;
import org.springframework.data.relational.core.mapping.PersistentPropertyPathExtension;

View File

@@ -23,8 +23,8 @@ import java.util.concurrent.atomic.AtomicReference;
import java.util.function.Consumer;
import org.assertj.core.api.SoftAssertions;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.data.annotation.Id;
import org.springframework.data.jdbc.core.mapping.JdbcMappingContext;
import org.springframework.data.jdbc.core.mapping.PersistentPropertyPathTestUtils;

View File

@@ -19,9 +19,9 @@ import static java.util.Collections.*;
import static org.assertj.core.api.Assertions.*;
import org.assertj.core.api.SoftAssertions;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.springframework.data.annotation.Id;
import org.springframework.data.jdbc.core.PropertyPathTestingUtils;
import org.springframework.data.jdbc.core.mapping.JdbcMappingContext;
@@ -48,7 +48,7 @@ public class SqlGeneratorEmbeddedUnitTests {
});
private SqlGenerator sqlGenerator;
@Before
@BeforeEach
public void setUp() {
this.context.setForceQuote(false);
this.sqlGenerator = createSqlGenerator(DummyEntity.class);
@@ -173,7 +173,7 @@ public class SqlGeneratorEmbeddedUnitTests {
}
@Test // DATAJDBC-340
@Ignore // this is just broken right now
@Disabled // this is just broken right now
public void deleteByPath() {
final String sql = sqlGenerator

View File

@@ -18,7 +18,7 @@ package org.springframework.data.jdbc.core.convert;
import static org.assertj.core.api.Assertions.*;
import org.assertj.core.api.SoftAssertions;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.data.annotation.Id;
import org.springframework.data.jdbc.core.mapping.JdbcMappingContext;

View File

@@ -23,8 +23,8 @@ import java.util.Map;
import java.util.Set;
import org.assertj.core.api.SoftAssertions;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.data.annotation.Id;
import org.springframework.data.annotation.ReadOnlyProperty;
import org.springframework.data.annotation.Version;
@@ -35,8 +35,8 @@ import org.springframework.data.jdbc.core.PropertyPathTestingUtils;
import org.springframework.data.jdbc.core.mapping.AggregateReference;
import org.springframework.data.jdbc.core.mapping.JdbcMappingContext;
import org.springframework.data.jdbc.core.mapping.PersistentPropertyPathTestUtils;
import org.springframework.data.relational.core.dialect.AnsiDialect;
import org.springframework.data.mapping.PersistentPropertyPath;
import org.springframework.data.relational.core.dialect.AnsiDialect;
import org.springframework.data.relational.core.dialect.Dialect;
import org.springframework.data.relational.core.mapping.Column;
import org.springframework.data.relational.core.mapping.NamingStrategy;
@@ -72,7 +72,7 @@ public class SqlGeneratorUnitTests {
throw new UnsupportedOperationException();
});
@Before
@BeforeEach
public void setUp() {
this.sqlGenerator = createSqlGenerator(DummyEntity.class);
}
@@ -223,8 +223,8 @@ public class SqlGeneratorUnitTests {
@Test // DATAJDBC-101
public void findAllSortedByMultipleFields() {
String sql = sqlGenerator.getFindAll(
Sort.by(new Sort.Order(Sort.Direction.DESC, "name"), new Sort.Order(Sort.Direction.ASC, "other")));
String sql = sqlGenerator
.getFindAll(Sort.by(new Sort.Order(Sort.Direction.DESC, "name"), new Sort.Order(Sort.Direction.ASC, "other")));
assertThat(sql).contains("SELECT", //
"dummy_entity.id1 AS id1", //
@@ -350,9 +350,10 @@ public class SqlGeneratorUnitTests {
+ "WHERE dummy_entity.backref = :backref");
}
@Test(expected = IllegalArgumentException.class) // DATAJDBC-130
@Test // DATAJDBC-130
public void findAllByPropertyOrderedWithoutKey() {
sqlGenerator.getFindAllByProperty(BACKREF, null, true);
assertThatExceptionOfType(IllegalArgumentException.class)
.isThrownBy(() -> sqlGenerator.getFindAllByProperty(BACKREF, null, true));
}
@Test // DATAJDBC-131, DATAJDBC-111

View File

@@ -16,7 +16,7 @@
package org.springframework.data.jdbc.core.convert;
import org.assertj.core.api.SoftAssertions;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.data.relational.core.sql.IdentifierProcessing;
import org.springframework.data.relational.core.sql.SqlIdentifier;

View File

@@ -27,7 +27,7 @@ import java.util.Date;
import java.util.List;
import java.util.UUID;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.data.annotation.Id;
import org.springframework.data.mapping.PersistentPropertyPath;
import org.springframework.data.relational.core.mapping.BasicRelationalPersistentProperty;

View File

@@ -2,7 +2,7 @@ package org.springframework.data.jdbc.core.mapping;
import static org.assertj.core.api.Assertions.*;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.data.jdbc.core.mapping.AggregateReference.IdOnlyAggregateReference;
/**

View File

@@ -16,13 +16,12 @@
package org.springframework.data.jdbc.degraph;
import static de.schauderhaft.degraph.check.JCheck.*;
import static org.junit.Assert.*;
import static org.hamcrest.MatcherAssert.*;
import de.schauderhaft.degraph.check.JCheck;
import org.junit.jupiter.api.Test;
import scala.runtime.AbstractFunction1;
import org.junit.Test;
/**
* Test package dependencies for violations.
*

View File

@@ -22,7 +22,7 @@ import lombok.Data;
import java.time.LocalDateTime;
import java.util.List;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.data.annotation.Id;
import org.springframework.data.jdbc.core.mapping.JdbcMappingContext;

View File

@@ -19,7 +19,7 @@ import java.util.HashMap;
import java.util.Map;
import org.assertj.core.api.SoftAssertions;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.data.jdbc.core.convert.Identifier;
import org.springframework.data.relational.core.sql.SqlIdentifier;

View File

@@ -24,9 +24,8 @@ import java.io.IOException;
import org.apache.ibatis.session.Configuration;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mybatis.spring.SqlSessionFactoryBean;
import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.beans.factory.annotation.Autowired;
@@ -45,8 +44,7 @@ import org.springframework.data.repository.CrudRepository;
import org.springframework.jdbc.datasource.embedded.EmbeddedDatabase;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.rules.SpringClassRule;
import org.springframework.test.context.junit4.rules.SpringMethodRule;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import org.springframework.transaction.annotation.Transactional;
/**
@@ -59,11 +57,9 @@ import org.springframework.transaction.annotation.Transactional;
@ContextConfiguration
@ActiveProfiles("hsql")
@Transactional
@ExtendWith(SpringExtension.class)
public class MyBatisCustomizingNamespaceHsqlIntegrationTests {
@ClassRule public static final SpringClassRule classRule = new SpringClassRule();
@Rule public SpringMethodRule methodRule = new SpringMethodRule();
@Autowired SqlSessionFactory sqlSessionFactory;
@Autowired DummyEntityRepository repository;

View File

@@ -23,8 +23,8 @@ import static org.mockito.Mockito.*;
import static org.springframework.data.relational.core.sql.SqlIdentifier.*;
import org.apache.ibatis.session.SqlSession;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.mockito.ArgumentCaptor;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
@@ -58,7 +58,7 @@ public class MyBatisDataAccessStrategyUnitTests {
PersistentPropertyPath<RelationalPersistentProperty> path = PropertyPathTestingUtils.toPath("one.two",
DummyEntity.class, context);
@Before
@BeforeEach
public void before() {
doReturn(false).when(session).selectOne(any(), any());

View File

@@ -22,9 +22,8 @@ import junit.framework.AssertionFailedError;
import org.apache.ibatis.session.Configuration;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mybatis.spring.SqlSessionFactoryBean;
import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.beans.factory.annotation.Autowired;
@@ -42,6 +41,7 @@ import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
import org.springframework.jdbc.datasource.embedded.EmbeddedDatabase;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import org.springframework.test.context.junit4.rules.SpringClassRule;
import org.springframework.test.context.junit4.rules.SpringMethodRule;
import org.springframework.transaction.annotation.Transactional;
@@ -56,10 +56,9 @@ import org.springframework.transaction.annotation.Transactional;
@ContextConfiguration
@ActiveProfiles("hsql")
@Transactional
@ExtendWith(SpringExtension.class)
public class MyBatisHsqlIntegrationTests {
@ClassRule public static final SpringClassRule classRule = new SpringClassRule();
@Rule public SpringMethodRule methodRule = new SpringMethodRule();
@Autowired SqlSessionFactory sqlSessionFactory;
@Autowired DummyEntityRepository repository;

View File

@@ -31,11 +31,10 @@ import java.util.concurrent.CountDownLatch;
import java.util.function.UnaryOperator;
import org.assertj.core.api.Assertions;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.junit.platform.commons.util.ExceptionUtils;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
@@ -48,9 +47,8 @@ import org.springframework.data.jdbc.repository.support.JdbcRepositoryFactory;
import org.springframework.data.jdbc.testing.TestConfiguration;
import org.springframework.data.repository.CrudRepository;
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.context.junit4.rules.SpringClassRule;
import org.springframework.test.context.junit4.rules.SpringMethodRule;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.support.TransactionTemplate;
@@ -60,7 +58,7 @@ import org.springframework.transaction.support.TransactionTemplate;
* @author Myeonghyeon Lee
* @author Jens Schauder
*/
@RunWith(SpringRunner.class)
@ExtendWith(SpringExtension.class)
public class JdbcRepositoryConcurrencyIntegrationTests {
@Configuration
@@ -90,7 +88,7 @@ public class JdbcRepositoryConcurrencyIntegrationTests {
TransactionTemplate transactionTemplate;
List<Exception> exceptions;
@BeforeClass
@BeforeAll
public static void beforeClass() {
Assertions.registerFormatterForType(CopyOnWriteArrayList.class, l -> {
@@ -99,7 +97,7 @@ public class JdbcRepositoryConcurrencyIntegrationTests {
l.forEach(e -> {
if (e instanceof Throwable) {
printThrowable(joiner,(Throwable) e);
printThrowable(joiner, (Throwable) e);
} else {
joiner.add(e.toString());
}
@@ -119,7 +117,7 @@ public class JdbcRepositoryConcurrencyIntegrationTests {
}
}
@Before
@BeforeEach
public void before() {
entity = repository.save(createDummyEntity());

View File

@@ -17,9 +17,8 @@ package org.springframework.data.jdbc.repository;
import static org.assertj.core.api.Assertions.*;
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
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.Bean;
import org.springframework.context.annotation.Configuration;
@@ -35,8 +34,7 @@ import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.rules.SpringClassRule;
import org.springframework.test.context.junit4.rules.SpringMethodRule;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import org.springframework.test.jdbc.JdbcTestUtils;
import org.springframework.transaction.annotation.Transactional;
@@ -50,6 +48,7 @@ import org.springframework.transaction.annotation.Transactional;
@ContextConfiguration
@Transactional
@ActiveProfiles("hsql")
@ExtendWith(SpringExtension.class)
public class JdbcRepositoryCrossAggregateHsqlIntegrationTests {
private static final long TWO_ID = 23L;
@@ -67,9 +66,6 @@ public class JdbcRepositoryCrossAggregateHsqlIntegrationTests {
}
}
@ClassRule public static final SpringClassRule classRule = new SpringClassRule();
@Rule public SpringMethodRule methodRule = new SpringMethodRule();
@Autowired NamedParameterJdbcTemplate template;
@Autowired Ones ones;
@Autowired RelationalMappingContext context;

View File

@@ -24,9 +24,8 @@ import java.sql.JDBCType;
import java.util.Date;
import org.assertj.core.api.SoftAssertions;
import org.junit.Test;
import org.junit.runner.RunWith;
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.Bean;
import org.springframework.context.annotation.Configuration;
@@ -43,7 +42,7 @@ import org.springframework.data.jdbc.testing.TestConfiguration;
import org.springframework.data.repository.CrudRepository;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestExecutionListeners;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import org.springframework.transaction.annotation.Transactional;
/**
@@ -55,7 +54,7 @@ import org.springframework.transaction.annotation.Transactional;
@ContextConfiguration
@Transactional
@TestExecutionListeners(value = AssumeFeatureRule.class, mergeMode = MERGE_WITH_DEFAULTS)
@RunWith(SpringRunner.class)
@ExtendWith(SpringExtension.class)
public class JdbcRepositoryCustomConversionIntegrationTests {
@Configuration

View File

@@ -15,16 +15,13 @@
*/
package org.springframework.data.jdbc.repository;
import static java.util.Arrays.*;
import static org.assertj.core.api.Assertions.*;
import lombok.Data;
import lombok.Value;
import lombok.With;
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
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.Bean;
import org.springframework.context.annotation.Configuration;
@@ -35,12 +32,9 @@ import org.springframework.data.jdbc.testing.TestConfiguration;
import org.springframework.data.relational.core.mapping.Embedded;
import org.springframework.data.relational.core.mapping.Embedded.OnEmpty;
import org.springframework.data.repository.CrudRepository;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.rules.SpringClassRule;
import org.springframework.test.context.junit4.rules.SpringMethodRule;
import org.springframework.test.jdbc.JdbcTestUtils;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import org.springframework.transaction.annotation.Transactional;
/**
@@ -50,6 +44,7 @@ import org.springframework.transaction.annotation.Transactional;
*/
@ContextConfiguration
@Transactional
@ExtendWith(SpringExtension.class)
public class JdbcRepositoryEmbeddedImmutableIntegrationTests {
@Configuration
@@ -70,9 +65,6 @@ public class JdbcRepositoryEmbeddedImmutableIntegrationTests {
}
@ClassRule public static final SpringClassRule classRule = new SpringClassRule();
@Rule public SpringMethodRule methodRule = new SpringMethodRule();
@Autowired NamedParameterJdbcTemplate template;
@Autowired DummyEntityRepository repository;

View File

@@ -20,9 +20,8 @@ import static org.assertj.core.api.Assertions.*;
import lombok.Data;
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
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.Bean;
import org.springframework.context.annotation.Configuration;
@@ -36,8 +35,7 @@ import org.springframework.data.repository.CrudRepository;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.rules.SpringClassRule;
import org.springframework.test.context.junit4.rules.SpringMethodRule;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import org.springframework.test.jdbc.JdbcTestUtils;
import org.springframework.transaction.annotation.Transactional;
@@ -49,6 +47,7 @@ import org.springframework.transaction.annotation.Transactional;
*/
@ContextConfiguration
@Transactional
@ExtendWith(SpringExtension.class)
public class JdbcRepositoryEmbeddedIntegrationTests {
@Configuration
@@ -69,9 +68,6 @@ public class JdbcRepositoryEmbeddedIntegrationTests {
}
@ClassRule public static final SpringClassRule classRule = new SpringClassRule();
@Rule public SpringMethodRule methodRule = new SpringMethodRule();
@Autowired NamedParameterJdbcTemplate template;
@Autowired DummyEntityRepository repository;
@@ -92,9 +88,11 @@ public class JdbcRepositoryEmbeddedIntegrationTests {
assertThat(repository.findById(entity.getId())).hasValueSatisfying(it -> {
assertThat(it.getId()).isEqualTo(entity.getId());
assertThat(it.getPrefixedEmbeddable().getTest()).isEqualTo(entity.getPrefixedEmbeddable().getTest());
assertThat(it.getPrefixedEmbeddable().getEmbeddable().getAttr()).isEqualTo(entity.getPrefixedEmbeddable().getEmbeddable().getAttr());
assertThat(it.getPrefixedEmbeddable().getEmbeddable().getAttr())
.isEqualTo(entity.getPrefixedEmbeddable().getEmbeddable().getAttr());
assertThat(it.getEmbeddable().getTest()).isEqualTo(entity.getEmbeddable().getTest());
assertThat(it.getEmbeddable().getEmbeddable().getAttr()).isEqualTo(entity.getEmbeddable().getEmbeddable().getAttr());
assertThat(it.getEmbeddable().getEmbeddable().getAttr())
.isEqualTo(entity.getEmbeddable().getEmbeddable().getAttr());
});
}
@@ -129,7 +127,8 @@ public class JdbcRepositoryEmbeddedIntegrationTests {
assertThat(repository.findById(entity.getId())).hasValueSatisfying(it -> {
assertThat(it.getPrefixedEmbeddable().getTest()).isEqualTo(saved.getPrefixedEmbeddable().getTest());
assertThat(it.getPrefixedEmbeddable().getEmbeddable().getAttr()).isEqualTo(saved.getPrefixedEmbeddable().getEmbeddable().getAttr());
assertThat(it.getPrefixedEmbeddable().getEmbeddable().getAttr())
.isEqualTo(saved.getPrefixedEmbeddable().getEmbeddable().getAttr());
});
}
@@ -153,7 +152,8 @@ public class JdbcRepositoryEmbeddedIntegrationTests {
assertThat(repository.findAll()) //
.extracting(d -> d.getPrefixedEmbeddable().getEmbeddable().getAttr()) //
.containsExactlyInAnyOrder(entity.getPrefixedEmbeddable().getEmbeddable().getAttr(), other.getPrefixedEmbeddable().getEmbeddable().getAttr());
.containsExactlyInAnyOrder(entity.getPrefixedEmbeddable().getEmbeddable().getAttr(),
other.getPrefixedEmbeddable().getEmbeddable().getAttr());
}
@Test // DATAJDBC-111
@@ -260,8 +260,7 @@ public class JdbcRepositoryEmbeddedIntegrationTests {
static class CascadedEmbeddable {
String test;
@Embedded(onEmpty = OnEmpty.USE_NULL, prefix = "PREFIX2_")
Embeddable embeddable;
@Embedded(onEmpty = OnEmpty.USE_NULL, prefix = "PREFIX2_") Embeddable embeddable;
}
@Data

View File

@@ -23,9 +23,8 @@ import lombok.Data;
import java.sql.SQLException;
import org.junit.Test;
import org.junit.runner.RunWith;
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.Bean;
import org.springframework.context.annotation.Configuration;
@@ -44,7 +43,7 @@ import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestExecutionListeners;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import org.springframework.test.jdbc.JdbcTestUtils;
import org.springframework.transaction.annotation.Transactional;
@@ -56,7 +55,7 @@ import org.springframework.transaction.annotation.Transactional;
@ContextConfiguration
@Transactional
@TestExecutionListeners(value = AssumeFeatureRule.class, mergeMode = MERGE_WITH_DEFAULTS)
@RunWith(SpringRunner.class)
@ExtendWith(SpringExtension.class)
public class JdbcRepositoryEmbeddedNotInAggregateRootIntegrationTests {
@Autowired NamedParameterJdbcTemplate template;

View File

@@ -24,9 +24,8 @@ import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
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.Bean;
import org.springframework.context.annotation.Configuration;
@@ -37,15 +36,14 @@ import org.springframework.data.jdbc.testing.TestConfiguration;
import org.springframework.data.relational.core.dialect.Dialect;
import org.springframework.data.relational.core.mapping.Column;
import org.springframework.data.relational.core.mapping.Embedded;
import org.springframework.data.relational.core.mapping.Embedded.OnEmpty;
import org.springframework.data.relational.core.mapping.MappedCollection;
import org.springframework.data.relational.core.mapping.Embedded.OnEmpty;
import org.springframework.data.relational.core.sql.SqlIdentifier;
import org.springframework.data.repository.CrudRepository;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.rules.SpringClassRule;
import org.springframework.test.context.junit4.rules.SpringMethodRule;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import org.springframework.test.jdbc.JdbcTestUtils;
import org.springframework.transaction.annotation.Transactional;
@@ -56,6 +54,7 @@ import org.springframework.transaction.annotation.Transactional;
*/
@ContextConfiguration
@Transactional
@ExtendWith(SpringExtension.class)
public class JdbcRepositoryEmbeddedWithCollectionIntegrationTests {
@Configuration
@@ -76,9 +75,6 @@ public class JdbcRepositoryEmbeddedWithCollectionIntegrationTests {
}
@ClassRule public static final SpringClassRule classRule = new SpringClassRule();
@Rule public SpringMethodRule methodRule = new SpringMethodRule();
@Autowired NamedParameterJdbcTemplate template;
@Autowired DummyEntityRepository repository;
@Autowired Dialect dialect;
@@ -260,8 +256,7 @@ public class JdbcRepositoryEmbeddedWithCollectionIntegrationTests {
@Data
private static class DummyEntity {
@Column("ID")
@Id Long id;
@Column("ID") @Id Long id;
String test;

View File

@@ -23,9 +23,8 @@ import lombok.Data;
import java.util.List;
import org.junit.Test;
import org.junit.runner.RunWith;
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.Bean;
import org.springframework.context.annotation.Configuration;
@@ -44,6 +43,7 @@ import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestExecutionListeners;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.jdbc.JdbcTestUtils;
import org.springframework.transaction.annotation.Transactional;
@@ -57,7 +57,7 @@ import org.springframework.transaction.annotation.Transactional;
@ContextConfiguration
@Transactional
@TestExecutionListeners(value = AssumeFeatureRule.class, mergeMode = MERGE_WITH_DEFAULTS)
@RunWith(SpringRunner.class)
@ExtendWith(SpringExtension.class)
public class JdbcRepositoryEmbeddedWithReferenceIntegrationTests {
@Autowired NamedParameterJdbcTemplate template;

View File

@@ -24,9 +24,8 @@ import lombok.experimental.FieldDefaults;
import java.util.concurrent.atomic.AtomicLong;
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
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.Bean;
import org.springframework.context.annotation.ComponentScan;
@@ -41,8 +40,7 @@ import org.springframework.data.relational.core.mapping.event.BeforeConvertCallb
import org.springframework.data.repository.CrudRepository;
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.rules.SpringClassRule;
import org.springframework.test.context.junit4.rules.SpringMethodRule;
import org.springframework.test.context.junit.jupiter.SpringExtension;
/**
* Testing special cases for id generation with {@link SimpleJdbcRepository}.
@@ -51,6 +49,7 @@ import org.springframework.test.context.junit4.rules.SpringMethodRule;
* @author Greg Turnquist
*/
@ContextConfiguration
@ExtendWith(SpringExtension.class)
public class JdbcRepositoryIdGenerationIntegrationTests {
@Configuration
@@ -65,9 +64,6 @@ public class JdbcRepositoryIdGenerationIntegrationTests {
}
}
@ClassRule public static final SpringClassRule classRule = new SpringClassRule();
@Rule public SpringMethodRule methodRule = new SpringMethodRule();
@Autowired NamedParameterJdbcTemplate template;
@Autowired ReadOnlyIdEntityRepository readOnlyIdrepository;
@Autowired PrimitiveIdEntityRepository primitiveIdRepository;

View File

@@ -28,10 +28,9 @@ import java.time.Instant;
import java.util.ArrayList;
import java.util.List;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
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.beans.factory.config.PropertiesFactoryBean;
import org.springframework.context.ApplicationListener;
@@ -54,7 +53,7 @@ import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
import org.springframework.test.context.TestExecutionListeners;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import org.springframework.test.jdbc.JdbcTestUtils;
import org.springframework.transaction.annotation.Transactional;
@@ -66,7 +65,7 @@ import org.springframework.transaction.annotation.Transactional;
*/
@Transactional
@TestExecutionListeners(value = AssumeFeatureRule.class, mergeMode = MERGE_WITH_DEFAULTS)
@RunWith(SpringRunner.class)
@ExtendWith(SpringExtension.class)
public class JdbcRepositoryIntegrationTests {
@Autowired NamedParameterJdbcTemplate template;
@@ -81,7 +80,7 @@ public class JdbcRepositoryIntegrationTests {
return entity;
}
@Before
@BeforeEach
public void before() {
eventListener.events.clear();
}

View File

@@ -33,8 +33,8 @@ import java.util.Set;
import org.assertj.core.api.Condition;
import org.assertj.core.api.SoftAssertions;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationListener;
import org.springframework.context.annotation.Bean;
@@ -50,7 +50,7 @@ import org.springframework.data.relational.core.mapping.event.BeforeSaveEvent;
import org.springframework.data.repository.CrudRepository;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestExecutionListeners;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import org.springframework.transaction.annotation.Transactional;
/**
@@ -64,7 +64,7 @@ import org.springframework.transaction.annotation.Transactional;
@ContextConfiguration
@Transactional
@TestExecutionListeners(value = AssumeFeatureRule.class, mergeMode = MERGE_WITH_DEFAULTS)
@RunWith(SpringRunner.class)
@ExtendWith(SpringExtension.class)
public class JdbcRepositoryPropertyConversionIntegrationTests {
@Autowired DummyEntityRepository repository;
@@ -197,11 +197,9 @@ public class JdbcRepositoryPropertyConversionIntegrationTests {
Date date;
LocalDateTime localDateTime;
// ensures conversion on id querying
@Id
private LocalDateTime idTimestamp;
@Id private LocalDateTime idTimestamp;
@MappedCollection(idColumn = "ID_TIMESTAMP")
Set<EntityWithColumnsRequiringConversionsRelation> relation;
@MappedCollection(idColumn = "ID_TIMESTAMP") Set<EntityWithColumnsRequiringConversionsRelation> relation;
}
// DATAJDBC-349

View File

@@ -28,9 +28,8 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
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.Bean;
import org.springframework.context.annotation.Configuration;
@@ -46,6 +45,7 @@ import org.springframework.jdbc.core.ResultSetExtractor;
import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import org.springframework.test.context.junit4.rules.SpringClassRule;
import org.springframework.test.context.junit4.rules.SpringMethodRule;
import org.springframework.transaction.annotation.Transactional;
@@ -57,6 +57,7 @@ import org.springframework.transaction.annotation.Transactional;
*/
@ContextConfiguration
@Transactional
@ExtendWith(SpringExtension.class)
public class JdbcRepositoryResultSetExtractorIntegrationTests {
@Configuration
@@ -77,9 +78,6 @@ public class JdbcRepositoryResultSetExtractorIntegrationTests {
}
@ClassRule public static final SpringClassRule classRule = new SpringClassRule();
@Rule public SpringMethodRule methodRule = new SpringMethodRule();
@Autowired NamedParameterJdbcTemplate template;
@Autowired PersonRepository personRepository;

View File

@@ -26,9 +26,8 @@ import java.util.HashSet;
import java.util.Set;
import java.util.concurrent.atomic.AtomicLong;
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationListener;
import org.springframework.context.annotation.Bean;
@@ -42,8 +41,7 @@ import org.springframework.data.repository.CrudRepository;
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.rules.SpringClassRule;
import org.springframework.test.context.junit4.rules.SpringMethodRule;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import org.springframework.transaction.annotation.Transactional;
/**
@@ -54,6 +52,7 @@ import org.springframework.transaction.annotation.Transactional;
@ContextConfiguration
@Transactional
@ActiveProfiles("hsql")
@ExtendWith(SpringExtension.class)
public class JdbcRepositoryWithCollectionsAndManuallyAssignedIdHsqlIntegrationTests {
static AtomicLong id = new AtomicLong(0);
@@ -94,9 +93,6 @@ public class JdbcRepositoryWithCollectionsAndManuallyAssignedIdHsqlIntegrationTe
}
}
@ClassRule public static final SpringClassRule classRule = new SpringClassRule();
@Rule public SpringMethodRule methodRule = new SpringMethodRule();
@Autowired NamedParameterJdbcTemplate template;
@Autowired DummyEntityRepository repository;

View File

@@ -27,10 +27,8 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.Set;
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
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.Bean;
import org.springframework.context.annotation.Configuration;
@@ -44,9 +42,8 @@ import org.springframework.data.repository.CrudRepository;
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestExecutionListeners;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.context.junit4.rules.SpringClassRule;
import org.springframework.test.context.junit4.rules.SpringMethodRule;
import org.springframework.transaction.annotation.Transactional;
/**
@@ -58,7 +55,7 @@ import org.springframework.transaction.annotation.Transactional;
@ContextConfiguration
@Transactional
@TestExecutionListeners(value = AssumeFeatureRule.class, mergeMode = MERGE_WITH_DEFAULTS)
@RunWith(SpringRunner.class)
@ExtendWith(SpringExtension.class)
public class JdbcRepositoryWithCollectionsIntegrationTests {
@Autowired NamedParameterJdbcTemplate template;

View File

@@ -27,9 +27,8 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
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.Bean;
import org.springframework.context.annotation.Configuration;
@@ -43,8 +42,7 @@ import org.springframework.data.repository.CrudRepository;
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestExecutionListeners;
import org.springframework.test.context.junit4.rules.SpringClassRule;
import org.springframework.test.context.junit4.rules.SpringMethodRule;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import org.springframework.transaction.annotation.Transactional;
/**
@@ -56,10 +54,9 @@ import org.springframework.transaction.annotation.Transactional;
@ContextConfiguration
@Transactional
@TestExecutionListeners(value = AssumeFeatureRule.class, mergeMode = MERGE_WITH_DEFAULTS)
@ExtendWith(SpringExtension.class)
public class JdbcRepositoryWithListsIntegrationTests {
@ClassRule public static final SpringClassRule classRule = new SpringClassRule();
@Rule public SpringMethodRule methodRule = new SpringMethodRule();
@Autowired NamedParameterJdbcTemplate template;
@Autowired DummyEntityRepository repository;

View File

@@ -26,10 +26,8 @@ import lombok.RequiredArgsConstructor;
import java.util.HashMap;
import java.util.Map;
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
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.Bean;
import org.springframework.context.annotation.Configuration;
@@ -43,9 +41,7 @@ import org.springframework.data.repository.CrudRepository;
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestExecutionListeners;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.context.junit4.rules.SpringClassRule;
import org.springframework.test.context.junit4.rules.SpringMethodRule;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import org.springframework.transaction.annotation.Transactional;
/**
@@ -57,7 +53,7 @@ import org.springframework.transaction.annotation.Transactional;
@ContextConfiguration
@Transactional
@TestExecutionListeners(value = AssumeFeatureRule.class, mergeMode = MERGE_WITH_DEFAULTS)
@RunWith(SpringRunner.class)
@ExtendWith(SpringExtension.class)
public class JdbcRepositoryWithMapsIntegrationTests {
@Configuration

View File

@@ -29,8 +29,8 @@ import java.util.HashMap;
import java.util.List;
import org.assertj.core.groups.Tuple;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.mockito.stubbing.Answer;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.data.annotation.Id;
@@ -83,7 +83,7 @@ public class SimpleJdbcRepositoryEventsUnitTests {
DummyEntityRepository repository;
DefaultDataAccessStrategy dataAccessStrategy;
@Before
@BeforeEach
public void before() {
RelationalMappingContext context = new JdbcMappingContext();

View File

@@ -26,9 +26,8 @@ import java.sql.SQLException;
import java.util.Arrays;
import java.util.List;
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
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.Bean;
import org.springframework.context.annotation.Configuration;
@@ -44,8 +43,7 @@ import org.springframework.jdbc.core.ResultSetExtractor;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.rules.SpringClassRule;
import org.springframework.test.context.junit4.rules.SpringMethodRule;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import org.springframework.transaction.annotation.Transactional;
/**
@@ -56,6 +54,7 @@ import org.springframework.transaction.annotation.Transactional;
*/
@ContextConfiguration
@Transactional
@ExtendWith(SpringExtension.class)
public class StringBasedJdbcQueryMappingConfigurationIntegrationTests {
private final static String CAR_MODEL = "ResultSetExtractor Car";
@@ -147,9 +146,6 @@ public class StringBasedJdbcQueryMappingConfigurationIntegrationTests {
List<String> findByNameWithRowMapperBean();
}
@ClassRule public static final SpringClassRule classRule = new SpringClassRule();
@Rule public SpringMethodRule methodRule = new SpringMethodRule();
@Autowired NamedParameterJdbcTemplate template;
@Autowired CarRepository carRepository;

View File

@@ -22,7 +22,7 @@ import java.util.Arrays;
import java.util.List;
import java.util.function.Consumer;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Bean;

View File

@@ -18,7 +18,7 @@ package org.springframework.data.jdbc.repository.config;
import static org.assertj.core.api.Assertions.*;
import static org.mockito.Mockito.*;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.data.jdbc.repository.QueryMappingConfiguration;
import org.springframework.jdbc.core.RowMapper;

View File

@@ -27,7 +27,7 @@ import java.util.function.Consumer;
import org.assertj.core.api.SoftAssertions;
import org.jetbrains.annotations.NotNull;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.context.ApplicationListener;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

View File

@@ -25,9 +25,9 @@ import java.util.Optional;
import javax.sql.DataSource;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
@@ -50,6 +50,7 @@ import org.springframework.jdbc.core.RowMapper;
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcOperations;
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.util.ReflectionUtils;
@@ -61,7 +62,7 @@ import org.springframework.util.ReflectionUtils;
* @author Evgeni Dimitrov
* @author Fei Dong
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ExtendWith(SpringExtension.class)
@ContextConfiguration(classes = TestConfiguration.class)
public class EnableJdbcRepositoriesIntegrationTests {
@@ -80,7 +81,7 @@ public class EnableJdbcRepositoriesIntegrationTests {
@Autowired @Qualifier("qualifierJdbcOperations") NamedParameterJdbcOperations qualifierJdbcOperations;
@Autowired @Qualifier("qualifierDataAccessStrategy") DataAccessStrategy qualifierDataAccessStrategy;
@BeforeClass
@BeforeAll
public static void setup() {
MAPPER_MAP.setAccessible(true);

View File

@@ -19,7 +19,7 @@ import static org.assertj.core.api.Assertions.*;
import java.util.Collection;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import org.springframework.core.env.Environment;

View File

@@ -21,7 +21,7 @@ import static org.mockito.Mockito.*;
import java.util.List;
import org.apache.ibatis.session.SqlSession;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.jdbc.core.convert.CascadingDataAccessStrategy;

View File

@@ -24,8 +24,8 @@ import java.sql.ResultSet;
import java.util.Properties;
import org.jetbrains.annotations.NotNull;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.data.jdbc.core.mapping.JdbcMappingContext;
import org.springframework.data.projection.ProjectionFactory;
@@ -54,7 +54,7 @@ public class JdbcQueryMethodUnitTests {
NamedQueries namedQueries;
RepositoryMetadata metadata;
@Before
@BeforeEach
public void before() {
Properties properties = new Properties();

View File

@@ -27,9 +27,9 @@ import java.util.Date;
import java.util.List;
import java.util.Properties;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.junit.MockitoJUnitRunner;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.junit.jupiter.MockitoExtension;
import org.springframework.data.annotation.Id;
import org.springframework.data.jdbc.core.convert.BasicJdbcConverter;
import org.springframework.data.jdbc.core.convert.JdbcConverter;
@@ -57,7 +57,7 @@ import org.springframework.jdbc.core.namedparam.NamedParameterJdbcOperations;
* @author Jens Schauder
* @author Myeonghyeon Lee
*/
@RunWith(MockitoJUnitRunner.class)
@ExtendWith(MockitoExtension.class)
public class PartTreeJdbcQueryUnitTests {
private static final String TABLE = "\"users\"";
@@ -556,8 +556,8 @@ public class PartTreeJdbcQueryUnitTests {
PartTreeJdbcQuery jdbcQuery = createQuery(queryMethod);
ParametrizedQuery query = jdbcQuery.createQuery((getAccessor(queryMethod, new Object[] { "John" })));
assertThat(query.getQuery()).isEqualTo(
"SELECT COUNT(*) FROM " + TABLE + " WHERE " + TABLE + ".\"FIRST_NAME\" = :first_name");
assertThat(query.getQuery())
.isEqualTo("SELECT COUNT(*) FROM " + TABLE + " WHERE " + TABLE + ".\"FIRST_NAME\" = :first_name");
}
private PartTreeJdbcQuery createQuery(JdbcQueryMethod queryMethod) {

View File

@@ -26,9 +26,8 @@ import java.util.Optional;
import java.util.stream.Stream;
import org.assertj.core.api.SoftAssertions;
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
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.Bean;
import org.springframework.context.annotation.Configuration;
@@ -41,8 +40,7 @@ import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.query.Param;
import org.springframework.lang.Nullable;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.rules.SpringClassRule;
import org.springframework.test.context.junit4.rules.SpringMethodRule;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import org.springframework.transaction.annotation.Transactional;
/**
@@ -54,6 +52,7 @@ import org.springframework.transaction.annotation.Transactional;
*/
@Transactional
@ActiveProfiles("hsql")
@ExtendWith(SpringExtension.class)
public class QueryAnnotationHsqlIntegrationTests {
@Configuration
@@ -69,9 +68,6 @@ public class QueryAnnotationHsqlIntegrationTests {
@Autowired DummyEntityRepository repository;
@ClassRule public static final SpringClassRule classRule = new SpringClassRule();
@Rule public SpringMethodRule methodRule = new SpringMethodRule();
@Test // DATAJDBC-164
public void executeCustomQueryWithoutParameter() {

View File

@@ -22,7 +22,7 @@ import static org.springframework.data.domain.Sort.Order.*;
import java.util.Collections;
import java.util.List;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.data.domain.Sort;
import org.springframework.data.jdbc.core.convert.BasicJdbcConverter;
import org.springframework.data.jdbc.core.convert.JdbcConverter;

View File

@@ -22,10 +22,9 @@ import java.sql.ResultSet;
import org.assertj.core.api.Assertions;
import org.jetbrains.annotations.NotNull;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.dao.DataAccessException;
import org.springframework.data.jdbc.core.convert.BasicJdbcConverter;
import org.springframework.data.jdbc.core.convert.JdbcConverter;
@@ -56,7 +55,7 @@ public class StringBasedJdbcQueryUnitTests {
RelationalMappingContext context;
JdbcConverter converter;
@Before
@BeforeEach
public void setup() throws NoSuchMethodException {
this.queryMethod = mock(JdbcQueryMethod.class);

View File

@@ -21,10 +21,9 @@ import static org.mockito.Mockito.*;
import java.lang.reflect.Method;
import java.text.NumberFormat;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.data.jdbc.core.convert.JdbcConverter;
import org.springframework.data.jdbc.repository.QueryMappingConfiguration;
@@ -65,7 +64,7 @@ public class JdbcQueryLookupStrategyUnitTests {
NamedQueries namedQueries = mock(NamedQueries.class);
NamedParameterJdbcOperations operations = mock(NamedParameterJdbcOperations.class);
@Before
@BeforeEach
public void setup() {
this.metadata = mock(RepositoryMetadata.class);

View File

@@ -20,12 +20,14 @@ import static org.mockito.Mockito.*;
import java.util.function.Supplier;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Answers;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
import org.mockito.junit.jupiter.MockitoExtension;
import org.mockito.junit.jupiter.MockitoSettings;
import org.mockito.quality.Strictness;
import org.mockito.stubbing.Answer;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.ListableBeanFactory;
@@ -53,7 +55,8 @@ import org.springframework.test.util.ReflectionTestUtils;
* @author Mark Paluch
* @author Evgeni Dimitrov
*/
@RunWith(MockitoJUnitRunner.Silent.class)
@MockitoSettings(strictness = Strictness.LENIENT)
@ExtendWith(MockitoExtension.class)
public class JdbcRepositoryFactoryBeanUnitTests {
JdbcRepositoryFactoryBean<DummyEntityRepository, DummyEntity, Long> factoryBean;
@@ -65,7 +68,7 @@ public class JdbcRepositoryFactoryBeanUnitTests {
RelationalMappingContext mappingContext;
@Before
@BeforeEach
public void setUp() {
this.mappingContext = new JdbcMappingContext();
@@ -95,15 +98,17 @@ public class JdbcRepositoryFactoryBeanUnitTests {
assertThat(factoryBean.getObject()).isNotNull();
}
@Test(expected = IllegalArgumentException.class) // DATAJDBC-151
@Test // DATAJDBC-151
public void requiresListableBeanFactory() {
factoryBean.setBeanFactory(mock(BeanFactory.class));
assertThatExceptionOfType(IllegalArgumentException.class)
.isThrownBy(() -> factoryBean.setBeanFactory(mock(BeanFactory.class)));
}
@Test(expected = IllegalArgumentException.class) // DATAJDBC-155
@Test // DATAJDBC-155
public void afterPropertiesThrowsExceptionWhenNoMappingContextSet() {
factoryBean.setMappingContext(null);
assertThatExceptionOfType(IllegalArgumentException.class).isThrownBy(() -> factoryBean.setMappingContext(null));
}
@Test // DATAJDBC-155

View File

@@ -16,13 +16,13 @@
package org.springframework.data.jdbc.repository.support;
import static org.assertj.core.api.Assertions.*;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.*;
import static org.mockito.Mockito.*;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
import org.mockito.junit.jupiter.MockitoExtension;
import org.springframework.data.jdbc.core.JdbcAggregateOperations;
import org.springframework.data.relational.core.mapping.RelationalPersistentEntity;
@@ -31,7 +31,7 @@ import org.springframework.data.relational.core.mapping.RelationalPersistentEnti
*
* @author Oliver Gierke
*/
@RunWith(MockitoJUnitRunner.class)
@ExtendWith(MockitoExtension.class)
public class SimpleJdbcRepositoryUnitTests {
@Mock JdbcAggregateOperations operations;

View File

@@ -22,8 +22,8 @@ import lombok.Value;
import java.util.Set;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.core.convert.converter.GenericConverter;
import org.springframework.data.convert.ConverterBuilder;
@@ -44,7 +44,7 @@ public class BasicRelationalConverterUnitTests {
RelationalMappingContext context = new RelationalMappingContext();
RelationalConverter converter;
@Before
@BeforeEach
public void before() throws Exception {
Set<GenericConverter> converters = ConverterBuilder.writing(MyValue.class, String.class, MyValue::getFoo)

View File

@@ -15,9 +15,9 @@
*/
package org.springframework.data.relational.core.conversion;
import static org.mockito.Mockito.*;
import org.junit.jupiter.api.Test;
import org.junit.Test;
import static org.mockito.Mockito.*;
/**
* Unit test for {@link DbActionExecutionException}.

View File

@@ -16,25 +16,31 @@
package org.springframework.data.relational.core.conversion;
import lombok.Data;
import org.assertj.core.api.Assertions;
import org.assertj.core.groups.Tuple;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.junit.MockitoJUnitRunner;
import org.springframework.data.annotation.Id;
import org.springframework.data.relational.core.conversion.DbAction.*;
import org.springframework.data.relational.core.mapping.RelationalMappingContext;
import java.util.ArrayList;
import java.util.List;
import org.assertj.core.api.Assertions;
import org.assertj.core.groups.Tuple;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.junit.jupiter.MockitoExtension;
import org.springframework.data.annotation.Id;
import org.springframework.data.relational.core.conversion.DbAction.AcquireLockAllRoot;
import org.springframework.data.relational.core.conversion.DbAction.AcquireLockRoot;
import org.springframework.data.relational.core.conversion.DbAction.Delete;
import org.springframework.data.relational.core.conversion.DbAction.DeleteAll;
import org.springframework.data.relational.core.conversion.DbAction.DeleteAllRoot;
import org.springframework.data.relational.core.conversion.DbAction.DeleteRoot;
import org.springframework.data.relational.core.mapping.RelationalMappingContext;
/**
* Unit tests for the {@link org.springframework.data.relational.core.conversion.RelationalEntityDeleteWriter}
*
* @author Jens Schauder
* @author Myeonghyeon Lee
*/
@RunWith(MockitoJUnitRunner.class)
@ExtendWith(MockitoExtension.class)
public class RelationalEntityDeleteWriterUnitTests {
RelationalEntityDeleteWriter converter = new RelationalEntityDeleteWriter(new RelationalMappingContext());
@@ -68,8 +74,8 @@ public class RelationalEntityDeleteWriterUnitTests {
converter.write(entity.id, aggregateChange);
Assertions.assertThat(extractActions(aggregateChange))
.extracting(DbAction::getClass, DbAction::getEntityType, DbActionTestSupport::extractPath) //
.containsExactly(Tuple.tuple(DeleteRoot.class, SingleEntity.class, ""));
.extracting(DbAction::getClass, DbAction::getEntityType, DbActionTestSupport::extractPath) //
.containsExactly(Tuple.tuple(DeleteRoot.class, SingleEntity.class, ""));
}
@Test // DATAJDBC-188
@@ -97,8 +103,8 @@ public class RelationalEntityDeleteWriterUnitTests {
converter.write(null, aggregateChange);
Assertions.assertThat(extractActions(aggregateChange))
.extracting(DbAction::getClass, DbAction::getEntityType, DbActionTestSupport::extractPath) //
.containsExactly(Tuple.tuple(DeleteAllRoot.class, SingleEntity.class, ""));
.extracting(DbAction::getClass, DbAction::getEntityType, DbActionTestSupport::extractPath) //
.containsExactly(Tuple.tuple(DeleteAllRoot.class, SingleEntity.class, ""));
}
private List<DbAction<?>> extractActions(MutableAggregateChange<?> aggregateChange) {

View File

@@ -22,9 +22,9 @@ import lombok.RequiredArgsConstructor;
import java.util.ArrayList;
import java.util.List;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.junit.MockitoJUnitRunner;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.junit.jupiter.MockitoExtension;
import org.springframework.data.annotation.Id;
import org.springframework.data.relational.core.conversion.DbAction.InsertRoot;
import org.springframework.data.relational.core.mapping.RelationalMappingContext;
@@ -34,7 +34,7 @@ import org.springframework.data.relational.core.mapping.RelationalMappingContext
*
* @author Thomas Lang
*/
@RunWith(MockitoJUnitRunner.class)
@ExtendWith(MockitoExtension.class)
public class RelationalEntityInsertWriterUnitTests {
public static final long SOME_ENTITY_ID = 23L;

View File

@@ -22,9 +22,9 @@ import lombok.RequiredArgsConstructor;
import java.util.ArrayList;
import java.util.List;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.junit.MockitoJUnitRunner;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.junit.jupiter.MockitoExtension;
import org.springframework.data.annotation.Id;
import org.springframework.data.relational.core.mapping.RelationalMappingContext;
@@ -34,7 +34,7 @@ import org.springframework.data.relational.core.mapping.RelationalMappingContext
* @author Thomas Lang
* @author Myeonghyeon Lee
*/
@RunWith(MockitoJUnitRunner.class)
@ExtendWith(MockitoExtension.class)
public class RelationalEntityUpdateWriterUnitTests {
public static final long SOME_ENTITY_ID = 23L;

View File

@@ -26,9 +26,9 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.junit.MockitoJUnitRunner;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.junit.jupiter.MockitoExtension;
import org.springframework.data.annotation.Id;
import org.springframework.data.mapping.PersistentPropertyPath;
import org.springframework.data.mapping.PersistentPropertyPaths;
@@ -37,9 +37,9 @@ import org.springframework.data.relational.core.conversion.DbAction.Insert;
import org.springframework.data.relational.core.conversion.DbAction.InsertRoot;
import org.springframework.data.relational.core.conversion.DbAction.UpdateRoot;
import org.springframework.data.relational.core.mapping.Embedded;
import org.springframework.data.relational.core.mapping.Embedded.OnEmpty;
import org.springframework.data.relational.core.mapping.RelationalMappingContext;
import org.springframework.data.relational.core.mapping.RelationalPersistentProperty;
import org.springframework.data.relational.core.mapping.Embedded.OnEmpty;
import org.springframework.lang.Nullable;
/**
@@ -50,7 +50,7 @@ import org.springframework.lang.Nullable;
* @author Mark Paluch
* @author Myeonghyeon Lee
*/
@RunWith(MockitoJUnitRunner.class)
@ExtendWith(MockitoExtension.class)
public class RelationalEntityWriterUnitTests {
static final long SOME_ENTITY_ID = 23L;

View File

@@ -17,7 +17,7 @@ package org.springframework.data.relational.core.dialect;
import static org.assertj.core.api.Assertions.*;
import org.junit.Test;
import org.junit.jupiter.api.Test;
/**
* Unit tests for {@link Escaper}.

View File

@@ -15,7 +15,7 @@
*/
package org.springframework.data.relational.core.dialect;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.data.relational.core.sql.From;
import org.springframework.data.relational.core.sql.LockMode;
import org.springframework.data.relational.core.sql.LockOptions;

View File

@@ -17,8 +17,8 @@ package org.springframework.data.relational.core.dialect;
import static org.assertj.core.api.Assertions.*;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.data.relational.core.sql.LockMode;
import org.springframework.data.relational.core.sql.Select;
@@ -38,7 +38,7 @@ public class MySqlDialectRenderingUnitTests {
private final RenderContextFactory factory = new RenderContextFactory(MySqlDialect.INSTANCE);
@Before
@BeforeEach
public void before() {
factory.setNamingStrategy(NamingStrategies.asIs());
}

View File

@@ -15,7 +15,7 @@
*/
package org.springframework.data.relational.core.dialect;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.data.relational.core.sql.From;
import org.springframework.data.relational.core.sql.LockMode;
import org.springframework.data.relational.core.sql.LockOptions;

View File

@@ -17,8 +17,8 @@ package org.springframework.data.relational.core.dialect;
import static org.assertj.core.api.Assertions.*;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.data.relational.core.sql.LockMode;
import org.springframework.data.relational.core.sql.Select;
@@ -38,7 +38,7 @@ public class PostgresDialectRenderingUnitTests {
private final RenderContextFactory factory = new RenderContextFactory(PostgresDialect.INSTANCE);
@Before
@BeforeEach
public void before() throws Exception {
factory.setNamingStrategy(NamingStrategies.asIs());
}

View File

@@ -19,7 +19,7 @@ import static org.assertj.core.api.Assertions.*;
import static org.assertj.core.api.SoftAssertions.*;
import static org.mockito.Mockito.*;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.data.relational.core.sql.From;
import org.springframework.data.relational.core.sql.LockMode;
import org.springframework.data.relational.core.sql.LockOptions;

View File

@@ -17,8 +17,8 @@ package org.springframework.data.relational.core.dialect;
import static org.assertj.core.api.Assertions.*;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.data.relational.core.sql.LockMode;
import org.springframework.data.relational.core.sql.Select;
@@ -38,7 +38,7 @@ public class SqlServerDialectRenderingUnitTests {
private final RenderContextFactory factory = new RenderContextFactory(SqlServerDialect.INSTANCE);
@Before
@BeforeEach
public void before() {
factory.setNamingStrategy(NamingStrategies.asIs());
}

View File

@@ -18,7 +18,7 @@ package org.springframework.data.relational.core.dialect;
import static org.assertj.core.api.Assertions.*;
import static org.mockito.Mockito.*;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.data.relational.core.sql.From;
import org.springframework.data.relational.core.sql.LockMode;

View File

@@ -28,12 +28,10 @@ import java.util.List;
import java.util.UUID;
import java.util.function.BiConsumer;
import org.assertj.core.api.Assertions;
import org.assertj.core.api.SoftAssertions;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.data.annotation.Id;
import org.springframework.data.mapping.PersistentPropertyPath;
import org.springframework.data.mapping.PropertyHandler;
import org.springframework.data.relational.core.mapping.Embedded.OnEmpty;
/**

View File

@@ -18,7 +18,7 @@ package org.springframework.data.relational.core.mapping;
import static org.assertj.core.api.Assertions.*;
import org.assertj.core.api.SoftAssertions;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.data.relational.core.sql.IdentifierProcessing;
import org.springframework.data.relational.core.sql.IdentifierProcessing.LetterCasing;

View File

@@ -20,8 +20,7 @@ import static org.assertj.core.api.Assertions.*;
import java.time.LocalDateTime;
import java.util.List;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.data.annotation.Id;
import org.springframework.data.relational.core.mapping.RelationalPersistentEntityImplUnitTests.DummySubEntity;

View File

@@ -21,7 +21,7 @@ import java.util.Arrays;
import java.util.HashSet;
import java.util.UUID;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.data.annotation.Id;
import org.springframework.data.mapping.model.SimpleTypeHolder;

View File

@@ -18,7 +18,7 @@ package org.springframework.data.relational.core.mapping;
import static org.assertj.core.api.Assertions.*;
import static org.springframework.data.relational.core.sql.SqlIdentifier.*;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.data.annotation.Id;
import org.springframework.data.relational.core.sql.IdentifierProcessing;

View File

@@ -20,7 +20,7 @@ import static org.assertj.core.api.Assertions.*;
import java.util.ArrayList;
import java.util.List;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.data.relational.core.conversion.MutableAggregateChange;
/**

View File

@@ -21,7 +21,7 @@ import static org.springframework.data.relational.core.query.Criteria.*;
import java.util.Arrays;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.data.relational.core.sql.SqlIdentifier;

View File

@@ -17,7 +17,7 @@ package org.springframework.data.relational.core.query;
import static org.assertj.core.api.Assertions.*;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;

View File

@@ -15,7 +15,7 @@
*/
package org.springframework.data.relational.core.query;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.*;

View File

@@ -17,10 +17,7 @@ package org.springframework.data.relational.core.sql;
import static org.assertj.core.api.Assertions.*;
import org.junit.Test;
import org.springframework.data.relational.core.sql.DefaultIdentifierProcessing;
import org.springframework.data.relational.core.sql.IdentifierProcessing;
import org.junit.jupiter.api.Test;
import org.springframework.data.relational.core.sql.IdentifierProcessing.LetterCasing;
import org.springframework.data.relational.core.sql.IdentifierProcessing.Quoting;

View File

@@ -17,7 +17,7 @@ package org.springframework.data.relational.core.sql;
import static org.assertj.core.api.Assertions.*;
import org.junit.Test;
import org.junit.jupiter.api.Test;
/**
* Unit tests for {@link DeleteBuilder}.

View File

@@ -17,7 +17,7 @@ package org.springframework.data.relational.core.sql;
import static org.assertj.core.api.Assertions.*;
import org.junit.Test;
import org.junit.jupiter.api.Test;
/**
* Unit tests for {@link DeleteValidator}.

View File

@@ -15,9 +15,9 @@
*/
package org.springframework.data.relational.core.sql;
import static org.assertj.core.api.Assertions.*;
import org.junit.jupiter.api.Test;
import org.junit.Test;
import static org.assertj.core.api.Assertions.*;
/**
* Unit tests for {@link InsertBuilder}.

View File

@@ -19,7 +19,7 @@ import static org.assertj.core.api.Assertions.*;
import java.util.OptionalLong;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.data.relational.core.sql.Join.JoinType;

View File

@@ -15,9 +15,9 @@
*/
package org.springframework.data.relational.core.sql;
import static org.assertj.core.api.Assertions.*;
import org.junit.jupiter.api.Test;
import org.junit.Test;
import static org.assertj.core.api.Assertions.*;
/**
* Unit tests for {@link SelectValidator}.

View File

@@ -19,12 +19,10 @@ import static org.assertj.core.api.Assertions.*;
import static org.springframework.data.relational.core.sql.SqlIdentifier.*;
import org.assertj.core.api.SoftAssertions;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.data.relational.core.sql.IdentifierProcessing;
import org.springframework.data.relational.core.sql.IdentifierProcessing.LetterCasing;
import org.springframework.data.relational.core.sql.IdentifierProcessing.Quoting;
import org.springframework.data.relational.core.sql.SqlIdentifier;
/**
* Unit tests for {@link SqlIdentifier}.

View File

@@ -15,9 +15,9 @@
*/
package org.springframework.data.relational.core.sql;
import static org.assertj.core.api.Assertions.*;
import org.junit.jupiter.api.Test;
import org.junit.Test;
import static org.assertj.core.api.Assertions.*;
/**
* Unit tests for {@link UpdateBuilder}.

View File

@@ -17,7 +17,7 @@ package org.springframework.data.relational.core.sql.render;
import static org.assertj.core.api.Assertions.*;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.data.relational.core.sql.Column;
import org.springframework.data.relational.core.sql.Conditions;

View File

@@ -17,7 +17,7 @@ package org.springframework.data.relational.core.sql.render;
import static org.assertj.core.api.Assertions.*;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.data.relational.core.sql.Delete;
import org.springframework.data.relational.core.sql.SQL;
import org.springframework.data.relational.core.sql.Table;

View File

@@ -17,7 +17,7 @@ package org.springframework.data.relational.core.sql.render;
import static org.assertj.core.api.Assertions.*;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.data.relational.core.sql.Insert;
import org.springframework.data.relational.core.sql.SQL;
import org.springframework.data.relational.core.sql.Table;

View File

@@ -17,7 +17,7 @@ package org.springframework.data.relational.core.sql.render;
import static org.assertj.core.api.Assertions.*;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.data.relational.core.sql.Column;
import org.springframework.data.relational.core.sql.OrderByField;
import org.springframework.data.relational.core.sql.SQL;

View File

@@ -17,7 +17,7 @@ package org.springframework.data.relational.core.sql.render;
import static org.assertj.core.api.Assertions.*;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.data.relational.core.dialect.PostgresDialect;
import org.springframework.data.relational.core.dialect.RenderContextFactory;

View File

@@ -17,7 +17,7 @@ package org.springframework.data.relational.core.sql.render;
import static org.assertj.core.api.Assertions.*;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.data.relational.core.sql.Column;
import org.springframework.data.relational.core.sql.SQL;

View File

@@ -16,13 +16,12 @@
package org.springframework.data.relational.degraph;
import static de.schauderhaft.degraph.check.JCheck.*;
import static org.junit.Assert.*;
import static org.hamcrest.MatcherAssert.*;
import de.schauderhaft.degraph.check.JCheck;
import org.junit.jupiter.api.Test;
import scala.runtime.AbstractFunction1;
import org.junit.Test;
/**
* Test package dependencies for violations.
*

Some files were not shown because too many files have changed in this diff Show More