Skip to content

Commit e917cbf

Browse files
committed
Polishing.
Related: #2746.
1 parent c510e28 commit e917cbf

File tree

40 files changed

+230
-222
lines changed

40 files changed

+230
-222
lines changed

spring-data-envers/src/test/java/org/springframework/data/envers/repository/support/RepositoryIntegrationTests.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@
1515
*/
1616
package org.springframework.data.envers.repository.support;
1717

18-
import static org.assertj.core.api.Assertions.*;
19-
import static org.springframework.data.history.RevisionMetadata.RevisionType.*;
18+
import static org.assertj.core.api.Assertions.assertThat;
19+
import static org.springframework.data.history.RevisionMetadata.RevisionType.DELETE;
20+
import static org.springframework.data.history.RevisionMetadata.RevisionType.INSERT;
21+
import static org.springframework.data.history.RevisionMetadata.RevisionType.UPDATE;
2022

2123
import java.util.Arrays;
2224
import java.util.HashSet;
@@ -27,7 +29,6 @@
2729
import org.junit.jupiter.api.BeforeEach;
2830
import org.junit.jupiter.api.Test;
2931
import org.junit.jupiter.api.extension.ExtendWith;
30-
3132
import org.springframework.beans.factory.annotation.Autowired;
3233
import org.springframework.data.domain.Page;
3334
import org.springframework.data.domain.PageRequest;
@@ -53,10 +54,8 @@
5354
@ContextConfiguration(classes = Config.class)
5455
class RepositoryIntegrationTests {
5556

56-
@Autowired
57-
LicenseRepository licenseRepository;
58-
@Autowired
59-
CountryRepository countryRepository;
57+
@Autowired LicenseRepository licenseRepository;
58+
@Autowired CountryRepository countryRepository;
6059

6160
@BeforeEach
6261
void setUp() {

spring-data-jpa/src/test/java/org/springframework/data/jpa/convert/threeten/Jsr310JpaConvertersIntegrationTests.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,12 @@
1515
*/
1616
package org.springframework.data.jpa.convert.threeten;
1717

18-
import static org.assertj.core.api.Assertions.*;
19-
import static org.assertj.core.api.Assumptions.*;
20-
import static org.springframework.data.jpa.support.EntityManagerTestUtils.*;
18+
import static org.assertj.core.api.Assertions.assertThat;
19+
import static org.assertj.core.api.Assumptions.assumeThat;
20+
import static org.springframework.data.jpa.support.EntityManagerTestUtils.currentEntityManagerIsAJpa21EntityManager;
21+
22+
import jakarta.persistence.EntityManager;
23+
import jakarta.persistence.PersistenceContext;
2124

2225
import java.time.Instant;
2326
import java.time.LocalDate;
@@ -26,9 +29,6 @@
2629
import java.time.ZoneId;
2730
import java.time.temporal.ChronoUnit;
2831

29-
import jakarta.persistence.EntityManager;
30-
import jakarta.persistence.PersistenceContext;
31-
3232
import org.junit.jupiter.api.Test;
3333
import org.springframework.context.annotation.Configuration;
3434
import org.springframework.data.jpa.domain.support.AbstractAttributeConverterIntegrationTests;

spring-data-jpa/src/test/java/org/springframework/data/jpa/domain/support/AuditingEntityListenerTests.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,13 @@
1515
*/
1616
package org.springframework.data.jpa.domain.support;
1717

18-
import static org.assertj.core.api.Assertions.*;
18+
import static org.assertj.core.api.Assertions.assertThat;
1919

2020
import java.time.LocalDateTime;
2121

2222
import org.junit.jupiter.api.BeforeEach;
2323
import org.junit.jupiter.api.Test;
2424
import org.junit.jupiter.api.extension.ExtendWith;
25-
2625
import org.springframework.beans.factory.annotation.Autowired;
2726
import org.springframework.data.domain.Auditable;
2827
import org.springframework.data.jpa.domain.sample.AnnotatedAuditableUser;

spring-data-jpa/src/test/java/org/springframework/data/jpa/provider/PersistenceProviderIntegrationTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,13 @@
1515
*/
1616
package org.springframework.data.jpa.provider;
1717

18-
import static org.assertj.core.api.Assertions.*;
18+
import static org.assertj.core.api.Assertions.assertThat;
1919

2020
import jakarta.persistence.EntityManager;
2121

2222
import org.junit.jupiter.api.BeforeEach;
2323
import org.junit.jupiter.api.Test;
2424
import org.junit.jupiter.api.extension.ExtendWith;
25-
2625
import org.springframework.beans.factory.annotation.Autowired;
2726
import org.springframework.context.annotation.ComponentScan.Filter;
2827
import org.springframework.context.annotation.Configuration;
@@ -60,6 +59,7 @@ public class PersistenceProviderIntegrationTests {
6059

6160
@BeforeEach
6261
void setUp() {
62+
6363
this.product = products.save(new Product());
6464
this.category = categories.save(new Category(product));
6565
}

spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/EclipseLinkNamespaceUserRepositoryTests.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,12 @@
1515
*/
1616
package org.springframework.data.jpa.repository;
1717

18-
import static org.assertj.core.api.Assertions.*;
18+
import static org.assertj.core.api.Assertions.assertThat;
1919

2020
import jakarta.persistence.Query;
2121

2222
import org.junit.jupiter.api.Disabled;
2323
import org.junit.jupiter.api.Test;
24-
2524
import org.springframework.data.jpa.repository.sample.UserRepository;
2625
import org.springframework.test.context.ContextConfiguration;
2726

@@ -43,8 +42,7 @@ class EclipseLinkNamespaceUserRepositoryTests extends NamespaceUserRepositoryTes
4342
* Ignored until https://bugs.eclipse.org/bugs/show_bug.cgi?id=422450 is resolved.
4443
*/
4544
@Override
46-
void sortByAssociationPropertyShouldUseLeftOuterJoin() {
47-
}
45+
void sortByAssociationPropertyShouldUseLeftOuterJoin() {}
4846

4947
/**
5048
* Ignored until https://bugs.eclipse.org/bugs/show_bug.cgi?id=422450 is resolved.
@@ -67,7 +65,8 @@ void queryProvidesCorrectNumberOfParametersForNativeQuery() {
6765

6866
Query query = em.createNativeQuery("select 1 from User where firstname=? and lastname=?");
6967
assertThat(query.getParameters()).describedAs(
70-
"Due to a bug eclipse has size 0; If this is no longer the case the special code path triggered in NamedOrIndexedQueryParameterSetter.registerExcessParameters can be removed").isEmpty();
68+
"Due to a bug eclipse has size 0; If this is no longer the case the special code path triggered in NamedOrIndexedQueryParameterSetter.registerExcessParameters can be removed")
69+
.isEmpty();
7170
}
7271

7372
/**
@@ -112,8 +111,7 @@ void findByEmptyArrayOfIntegers() {}
112111
* Ignores the test. Reconsider once https://bugs.eclipse.org/bugs/show_bug.cgi?id=533240 is fixed.
113112
*/
114113
@Override
115-
void findByAgeWithEmptyArrayOfIntegersOrFirstName() {
116-
}
114+
void findByAgeWithEmptyArrayOfIntegersOrFirstName() {}
117115

118116
/**
119117
* Ignores the test. Reconsider once https://bugs.eclipse.org/bugs/show_bug.cgi?id=533240 is fixed.

spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/EntityGraphRepositoryMethodsIntegrationTests.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
*/
1616
package org.springframework.data.jpa.repository;
1717

18-
import static org.assertj.core.api.Assertions.*;
19-
import static org.assertj.core.api.Assumptions.*;
20-
import static org.springframework.data.jpa.support.EntityManagerTestUtils.*;
18+
import static org.assertj.core.api.Assertions.assertThat;
19+
import static org.assertj.core.api.Assumptions.assumeThat;
20+
import static org.springframework.data.jpa.support.EntityManagerTestUtils.currentEntityManagerIsAJpa21EntityManager;
2121

2222
import jakarta.persistence.EntityManager;
2323
import jakarta.persistence.Persistence;

spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/MappedTypeRepositoryIntegrationTests.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@
1515
*/
1616
package org.springframework.data.jpa.repository;
1717

18-
import static org.assertj.core.api.Assertions.*;
19-
20-
import java.util.List;
18+
import static org.assertj.core.api.Assertions.assertThat;
19+
import static org.assertj.core.api.Assertions.assertThatCode;
2120

2221
import jakarta.persistence.EntityManager;
2322

23+
import java.util.List;
24+
2425
import org.junit.jupiter.api.Test;
2526
import org.junit.jupiter.api.extension.ExtendWith;
26-
2727
import org.springframework.beans.factory.annotation.Autowired;
2828
import org.springframework.data.domain.Page;
2929
import org.springframework.data.domain.PageRequest;

spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/OpenJpaNamespaceUserRepositoryTests.java

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,8 @@
1515
*/
1616
package org.springframework.data.jpa.repository;
1717

18-
import static org.assertj.core.api.Assertions.*;
19-
20-
import java.util.Arrays;
21-
import java.util.Collection;
22-
import java.util.List;
18+
import static org.assertj.core.api.Assertions.assertThat;
19+
import static org.assertj.core.api.Assertions.assertThatThrownBy;
2320

2421
import jakarta.persistence.EntityManager;
2522
import jakarta.persistence.PersistenceContext;
@@ -29,6 +26,10 @@
2926
import jakarta.persistence.criteria.ParameterExpression;
3027
import jakarta.persistence.criteria.Root;
3128

29+
import java.util.Arrays;
30+
import java.util.Collection;
31+
import java.util.List;
32+
3233
import org.junit.jupiter.api.Disabled;
3334
import org.junit.jupiter.api.Test;
3435
import org.springframework.data.jpa.domain.sample.User;
@@ -50,12 +51,8 @@ class OpenJpaNamespaceUserRepositoryTests extends NamespaceUserRepositoryTests {
5051
@Test
5152
void checkQueryValidationWithOpenJpa() {
5253

53-
assertThatThrownBy(() -> em.createQuery("something absurd"))
54-
.isInstanceOf(RuntimeException.class);
55-
56-
assertThatThrownBy(() -> em.createNamedQuery("not available"))
57-
.isInstanceOf(RuntimeException.class);
58-
54+
assertThatThrownBy(() -> em.createQuery("something absurd")).isInstanceOf(RuntimeException.class);
55+
assertThatThrownBy(() -> em.createNamedQuery("not available")).isInstanceOf(RuntimeException.class);
5956
}
6057

6158
/**

spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/ParentRepositoryIntegrationTests.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,20 @@
1515
*/
1616
package org.springframework.data.jpa.repository;
1717

18-
import static org.assertj.core.api.Assertions.*;
19-
20-
import java.util.List;
21-
import java.util.Set;
18+
import static org.assertj.core.api.Assertions.assertThat;
2219

2320
import jakarta.persistence.criteria.CriteriaBuilder;
2421
import jakarta.persistence.criteria.CriteriaQuery;
2522
import jakarta.persistence.criteria.Path;
2623
import jakarta.persistence.criteria.Predicate;
2724
import jakarta.persistence.criteria.Root;
2825

26+
import java.util.List;
27+
import java.util.Set;
28+
2929
import org.junit.jupiter.api.BeforeEach;
3030
import org.junit.jupiter.api.Test;
3131
import org.junit.jupiter.api.extension.ExtendWith;
32-
3332
import org.springframework.beans.factory.annotation.Autowired;
3433
import org.springframework.data.domain.Page;
3534
import org.springframework.data.domain.PageRequest;
@@ -86,6 +85,7 @@ public Predicate toPredicate(Root<Parent> root, CriteriaQuery<?> query, Criteria
8685

8786
@Test // DATAJPA-287
8887
void testWithJoin() {
88+
8989
Page<Parent> page = repository.findAll(new Specification<Parent>() {
9090
@Override
9191
public Predicate toPredicate(Root<Parent> root, CriteriaQuery<?> query, CriteriaBuilder cb) {

spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/RedeclaringRepositoryMethodsTests.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,13 @@
1515
*/
1616
package org.springframework.data.jpa.repository;
1717

18-
import static org.assertj.core.api.Assertions.*;
18+
import static org.assertj.core.api.Assertions.assertThat;
1919

2020
import java.util.List;
2121

2222
import org.junit.jupiter.api.BeforeEach;
2323
import org.junit.jupiter.api.Test;
2424
import org.junit.jupiter.api.extension.ExtendWith;
25-
2625
import org.springframework.beans.factory.annotation.Autowired;
2726
import org.springframework.data.domain.Page;
2827
import org.springframework.data.domain.PageRequest;

spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/RepositoryWithCompositeKeyTests.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@
1515
*/
1616
package org.springframework.data.jpa.repository;
1717

18-
import static org.assertj.core.api.Assertions.*;
18+
import static org.assertj.core.api.Assertions.assertThat;
19+
20+
import jakarta.persistence.EntityManager;
1921

2022
import java.util.Arrays;
2123
import java.util.Collections;
2224
import java.util.List;
2325

24-
import jakarta.persistence.EntityManager;
25-
2626
import org.junit.jupiter.api.Test;
2727
import org.junit.jupiter.api.extension.ExtendWith;
2828
import org.springframework.beans.factory.annotation.Autowired;

spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/RepositoryWithIdClassKeyTests.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,12 @@
1515
*/
1616
package org.springframework.data.jpa.repository;
1717

18-
import static org.assertj.core.api.Assertions.*;
18+
import static org.assertj.core.api.Assertions.assertThat;
1919

2020
import java.util.Optional;
2121

2222
import org.junit.jupiter.api.Test;
2323
import org.junit.jupiter.api.extension.ExtendWith;
24-
2524
import org.springframework.beans.factory.annotation.Autowired;
2625
import org.springframework.context.annotation.Configuration;
2726
import org.springframework.context.annotation.ImportResource;

spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/RoleRepositoryIntegrationTests.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,10 @@
1515
*/
1616
package org.springframework.data.jpa.repository;
1717

18-
import static org.assertj.core.api.Assertions.*;
18+
import static org.assertj.core.api.Assertions.assertThat;
1919

2020
import org.junit.jupiter.api.Test;
2121
import org.junit.jupiter.api.extension.ExtendWith;
22-
2322
import org.springframework.beans.factory.annotation.Autowired;
2423
import org.springframework.data.jpa.domain.sample.Role;
2524
import org.springframework.data.jpa.repository.sample.RoleRepository;

spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/SPR8954Tests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,20 @@
1515
*/
1616
package org.springframework.data.jpa.repository;
1717

18-
import static org.assertj.core.api.Assertions.*;
18+
import static org.assertj.core.api.Assertions.assertThat;
1919

2020
import java.util.Map;
2121

2222
import org.junit.jupiter.api.Test;
2323
import org.junit.jupiter.api.extension.ExtendWith;
24-
2524
import org.springframework.beans.factory.annotation.Autowired;
2625
import org.springframework.context.ApplicationContext;
2726
import org.springframework.data.jpa.repository.sample.UserRepository;
2827
import org.springframework.data.jpa.repository.support.JpaRepositoryFactoryBean;
2928
import org.springframework.data.repository.core.support.RepositoryFactoryInformation;
3029
import org.springframework.test.context.ContextConfiguration;
3130
import org.springframework.test.context.junit.jupiter.SpringExtension;
31+
3232
/**
3333
* @author Jens Schauder
3434
* @author Krzysztof Krason

spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/SimpleJpaParameterBindingTests.java

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,7 @@
1515
*/
1616
package org.springframework.data.jpa.repository;
1717

18-
import static org.assertj.core.api.Assertions.*;
19-
20-
import java.util.Arrays;
21-
import java.util.Collection;
22-
import java.util.List;
18+
import static org.assertj.core.api.Assertions.assertThat;
2319

2420
import jakarta.persistence.EntityManager;
2521
import jakarta.persistence.PersistenceContext;
@@ -29,10 +25,13 @@
2925
import jakarta.persistence.criteria.ParameterExpression;
3026
import jakarta.persistence.criteria.Root;
3127

28+
import java.util.Arrays;
29+
import java.util.Collection;
30+
import java.util.List;
31+
3232
import org.junit.jupiter.api.Disabled;
3333
import org.junit.jupiter.api.Test;
3434
import org.junit.jupiter.api.extension.ExtendWith;
35-
3635
import org.springframework.data.jpa.domain.sample.User;
3736
import org.springframework.test.context.ContextConfiguration;
3837
import org.springframework.test.context.junit.jupiter.SpringExtension;
@@ -45,8 +44,8 @@
4544
*/
4645
@ExtendWith(SpringExtension.class)
4746
@ContextConfiguration({ "classpath:application-context.xml"
48-
// , "classpath:eclipselink.xml"
49-
// , "classpath:openjpa.xml"
47+
// , "classpath:eclipselink.xml"
48+
// , "classpath:openjpa.xml"
5049
})
5150
@Transactional
5251
class SimpleJpaParameterBindingTests {

spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/StoredProcedureIntegrationTests.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@
1515
*/
1616
package org.springframework.data.jpa.repository;
1717

18-
import static org.assertj.core.api.Assertions.*;
19-
import static org.assertj.core.api.Assumptions.*;
20-
import static org.springframework.data.jpa.support.EntityManagerTestUtils.*;
21-
22-
import java.util.List;
18+
import static org.assertj.core.api.Assertions.assertThat;
19+
import static org.assertj.core.api.Assumptions.assumeThat;
20+
import static org.springframework.data.jpa.support.EntityManagerTestUtils.currentEntityManagerIsAJpa21EntityManager;
2321

2422
import jakarta.persistence.EntityManager;
2523
import jakarta.persistence.PersistenceContext;
2624

25+
import java.util.List;
26+
2727
import org.junit.jupiter.api.BeforeEach;
2828
import org.junit.jupiter.api.Disabled;
2929
import org.junit.jupiter.api.Test;

0 commit comments

Comments
 (0)