Skip to content

Commit acccb76

Browse files
committed
DATAJPA-1248 - Polishing.
1 parent 04af1dd commit acccb76

File tree

3 files changed

+17
-26
lines changed

3 files changed

+17
-26
lines changed

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

+3-7
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
*/
1616
package org.springframework.data.jpa.repository;
1717

18-
import static org.hamcrest.MatcherAssert.assertThat;
19-
import static org.hamcrest.Matchers.equalTo;
18+
import static org.hamcrest.MatcherAssert.*;
19+
import static org.hamcrest.Matchers.*;
2020

2121
import javax.persistence.Query;
2222

@@ -96,10 +96,6 @@ public void queryProvidesCorrectNumberOfParametersForNativeQuery() {
9696
/**
9797
* Ignored until https://bugs.eclipse.org/bugs/show_bug.cgi?id=525319 is fixed.
9898
*/
99-
@Ignore
10099
@Override
101-
@Test // DATAJPA-1248
102-
public void supportsProjectionsWithNativeQueriesAndCamelCaseProperty() {
103-
super.supportsProjectionsWithNativeQueriesAndCamelCaseProperty();
104-
}
100+
public void supportsProjectionsWithNativeQueriesAndCamelCaseProperty() {}
105101
}

src/test/java/org/springframework/data/jpa/repository/UserRepositoryTests.java

+4-5
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@
5656
import org.springframework.dao.InvalidDataAccessApiUsageException;
5757
import org.springframework.data.domain.Example;
5858
import org.springframework.data.domain.ExampleMatcher;
59+
import org.springframework.data.domain.ExampleMatcher.GenericPropertyMatcher;
60+
import org.springframework.data.domain.ExampleMatcher.StringMatcher;
5961
import org.springframework.data.domain.Page;
6062
import org.springframework.data.domain.PageImpl;
6163
import org.springframework.data.domain.PageRequest;
@@ -64,7 +66,6 @@
6466
import org.springframework.data.domain.Sort;
6567
import org.springframework.data.domain.Sort.Direction;
6668
import org.springframework.data.domain.Sort.Order;
67-
import org.springframework.data.domain.ExampleMatcher.*;
6869
import org.springframework.data.jpa.domain.Specification;
6970
import org.springframework.data.jpa.domain.sample.Address;
7071
import org.springframework.data.jpa.domain.sample.Role;
@@ -2212,10 +2213,8 @@ public void supportsProjectionsWithNativeQueriesAndCamelCaseProperty() throws Ex
22122213

22132214
String emailAddress = result.getEmailAddress();
22142215

2215-
assertThat(emailAddress) //
2216-
.isEqualTo(user.getEmailAddress()) //
2217-
.as("ensuring email is actually not null") //
2218-
.isNotNull();
2216+
assertThat(emailAddress, is(notNullValue()));
2217+
assertThat(emailAddress, is(user.getEmailAddress()));
22192218
}
22202219

22212220
private Page<User> executeSpecWithSort(Sort sort) {

src/test/java/org/springframework/data/jpa/repository/query/TupleConverterUnitTests.java

+10-14
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
*/
1616
package org.springframework.data.jpa.repository.query;
1717

18-
import static org.assertj.core.api.Assertions.*;
18+
import static org.hamcrest.CoreMatchers.*;
19+
import static org.junit.Assert.*;
1920
import static org.mockito.Mockito.*;
2021

2122
import java.util.Arrays;
@@ -26,7 +27,6 @@
2627
import javax.persistence.Tuple;
2728
import javax.persistence.TupleElement;
2829

29-
import org.assertj.core.api.SoftAssertions;
3030
import org.junit.Before;
3131
import org.junit.Test;
3232
import org.junit.runner.RunWith;
@@ -74,7 +74,7 @@ public void returnsSingleTupleElementIfItMatchesExpectedType() {
7474

7575
TupleConverter converter = new TupleConverter(type);
7676

77-
assertThat(converter.convert(tuple)).isEqualTo("Foo");
77+
assertThat(converter.convert(tuple), is((Object) "Foo"));
7878
}
7979

8080
@Test // DATAJPA-1024
@@ -86,11 +86,11 @@ public void returnsNullForSingleElementTupleWithNullValue() {
8686

8787
TupleConverter converter = new TupleConverter(type);
8888

89-
assertThat(converter.convert(tuple)).isNull();
89+
assertThat(converter.convert(tuple), is(nullValue()));
9090
}
9191

92-
@SuppressWarnings("unchecked")
9392
@Test // DATAJPA-1048
93+
@SuppressWarnings("unchecked")
9494
public void findsValuesForAllVariantsSupportedByTheTuple() {
9595

9696
Tuple tuple = new MockTuple();
@@ -99,14 +99,10 @@ public void findsValuesForAllVariantsSupportedByTheTuple() {
9999

100100
Map<String, Object> map = (Map<String, Object>) converter.convert(tuple);
101101

102-
SoftAssertions softly = new SoftAssertions();
103-
104-
softly.assertThat(map.get("ONE")).isEqualTo("one");
105-
softly.assertThat(map.get("one")).isEqualTo("one");
106-
softly.assertThat(map.get("OnE")).isEqualTo("one");
107-
softly.assertThat(map.get("oNe")).isEqualTo("one");
108-
109-
softly.assertAll();
102+
assertThat(map.get("ONE"), is((Object) "one"));
103+
assertThat(map.get("one"), is((Object) "one"));
104+
assertThat(map.get("OnE"), is((Object) "one"));
105+
assertThat(map.get("oNe"), is((Object) "one"));
110106
}
111107

112108
interface SampleRepository extends CrudRepository<Object, Long> {
@@ -151,7 +147,7 @@ public Object[] toArray() {
151147

152148
@Override
153149
public List<TupleElement<?>> getElements() {
154-
return Arrays.asList(one, two);
150+
return Arrays.<TupleElement<?>> asList(one, two);
155151
}
156152

157153
private static class StringTupleElement implements TupleElement<String> {

0 commit comments

Comments
 (0)