8000 move to junit 5 · arangodb/spring-data@4419b52 · GitHub
[go: up one dir, main page]

Skip to content

Commit 4419b52

Browse files
committed
move to junit 5
1 parent 59ee282 commit 4419b52

34 files changed

+289
-335
lines changed

integration-tests/pom.xml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,6 @@
5656
<groupId>org.junit.jupiter</groupId>
5757
<artifactId>junit-jupiter-params</artifactId>
5858
</dependency>
59-
<dependency>
60-
<groupId>org.junit.vintage</groupId>
61-
<artifactId>junit-vintage-engine</artifactId>
62-
</dependency>
6359
<dependency>
6460
<groupId>org.projectlombok</groupId>
6561
<artifactId>lombok</artifactId>

src/test/java/com/arangodb/springframework/AbstractArangoTest.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,19 @@
2020

2121
package com.arangodb.springframework;
2222

23-
import org.junit.AfterClass;
24-
import org.junit.Before;
25-
import org.junit.runner.RunWith;
23+
import org.junit.jupiter.api.AfterAll;
24+
import org.junit.jupiter.api.BeforeEach;
25+
import org.junit.jupiter.api.extension.ExtendWith;
2626
import org.springframework.beans.factory.annotation.Autowired;
2727
import org.springframework.test.context.ContextConfiguration;
28-
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
28+
import org.springframework.test.context.junit.jupiter.SpringExtension;
2929

3030
import com.arangodb.springframework.core.ArangoOperations;
3131

3232
/**
3333
* @author Mark Vollmary
3434
*/
35-
@RunWith(SpringJUnit4ClassRunner.class)
35+
@ExtendWith(SpringExtension.class)
3636
@ContextConfiguration(classes = { ArangoTestConfiguration.class })
3737
public abstract class AbstractArangoTest {
3838

@@ -47,15 +47,15 @@ protected AbstractArangoTest(final Class<?>... collections) {
4747
this.collections = collections;
4848
}
4949

50-
@Before
50+
@BeforeEach
5151
public void before() {
5252
for (final Class<?> collection : collections) {
5353
template.collection(collection).truncate();
5454
}
5555
AbstractArangoTest.staticTemplate = template;
5656
}
5757

58-
@AfterClass
58+
@AfterAll
5959
public static void afterClass() {
6060
staticTemplate.dropDatabase();
6161
}

src/test/java/com/arangodb/springframework/core/mapping/CustomMappingTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@
2020

2121
package com.arangodb.springframework.core.mapping;
2222

23+
import static org.hamcrest.MatcherAssert.assertThat;
2324
import static org.hamcrest.Matchers.is;
2425
import static org.hamcrest.Matchers.nullValue;
25-
import static org.junit.Assert.assertThat;
2626

2727
import java.util.Optional;
2828

29-
import org.junit.Test;
29+
import org.junit.jupiter.api.Test;
3030
import org.springframework.core.convert.converter.Converter;
3131

3232
import com.arangodb.entity.BaseDocument;

src/test/java/com/arangodb/springframework/core/mapping/EdgeMappingTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@
2020

2121
package com.arangodb.springframework.core.mapping;
2222

23+
import static org.hamcrest.MatcherAssert.assertThat;
2324
import static org.hamcrest.Matchers.is;
2425
import static org.hamcrest.Matchers.notNullValue;
25-
import static org.junit.Assert.assertThat;
2626

27-
import org.junit.Test;
27+
import org.junit.jupiter.api.Test;
2828

2929
import com.arangodb.springframework.AbstractArangoTest;
3030
import com.arangodb.springframework.annotation.From;

src/test/java/com/arangodb/springframework/core/mapping/FromMappingTest.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,18 @@
2020

2121
package com.arangodb.springframework.core.mapping;
2222

23+
import static org.hamcrest.MatcherAssert.assertThat;
2324
import static org.hamcrest.Matchers.hasItems;
2425
import static org.hamcrest.Matchers.instanceOf;
2526
import static org.hamcrest.Matchers.is;
26-
import static org.hamcrest.Matchers.isOneOf;
27+
import static org.hamcrest.Matchers.oneOf;
2728
import static org.hamcrest.Matchers.notNullValue;
28-
import static org.junit.Assert.assertThat;
2929

3030
import java.util.Collection;
3131
import java.util.Set;
3232
import java.util.stream.Collectors;
3333

34-
import org.junit.Test;
34+
import org.junit.jupiter.api.Test;
3535

3636
import com.arangodb.springframework.AbstractArangoTest;
3737
import com.arangodb.springframework.annotation.From;
@@ -67,7 +67,7 @@ public void documentFrom() {
6767
for (final BasicEdgeLazyTestEntity e : document.entities) {
6868
assertThat(e, instanceOf(BasicEdgeLazyTestEntity.class));
6969
assertThat(e.getId(), is(notNullValue()));
70-
assertThat(e.getId(), is(isOneOf(edge0.getId(), edge1.getId())));
70+
assertThat(e.getId(), is(oneOf(edge0.getId(), edge1.getId())));
7171
assertThat(e.getFrom(), is(notNullValue()));
7272
assertThat(e.getFrom().getId(), is(notNullValue()));
7373
assertThat(e.getFrom().getId(), is(e0.getId()));
@@ -96,7 +96,7 @@ public void documentFromLazy() {
9696
for (final BasicEdgeLazyTestEntity e : document.entities) {
9797
assertThat(e, instanceOf(BasicEdgeLazyTestEntity.class));
9898
assertThat(e.getId(), is(notNullValue()));
99-
assertThat(e.getId(), is(isOneOf(edge0.getId(), edge1.getId())));
99+
assertThat(e.getId(), is(oneOf(edge0.getId(), edge1.getId())));
100100
assertThat(e.getFrom(), is(notNullValue()));
101101
assertThat(e.getFrom().getId(), is(notNullValue()));
102102
assertThat(e.getFrom().getId(), is(e0.getId()));
@@ -125,7 +125,7 @@ public void documentFromLazySet() {
125125
for (final BasicEdgeLazyTestEntity e : document.entities) {
126126
assertThat(e, instanceOf(BasicEdgeLazyTestEntity.class));
127127
assertThat(e.getId(), is(notNullValue()));
128-
assertThat(e.getId(), is(isOneOf(edge0.getId(), edge1.getId())));
128+
assertThat(e.getId(), is(oneOf(edge0.getId(), edge1.getId())));
129129
assertThat(e.getFrom(), is(notNullValue()));
130130
assertThat(e.getFrom().getId(), is(notNullValue()));
131131
assertThat(e.getFrom().getId(), is(e0.getId()));

src/test/java/com/arangodb/springframework/core/mapping/GeneralMappingTest.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
import org.joda.time.DateTimeZone;
4444
import org.json.JSONException;
4545
import org.json.JSONObject;
46-
import org.junit.Test;
46+
import org.junit.jupiter.api.Test;
4747
import org.skyscreamer.jsonassert.JSONAssert;
4848
import org.springframework.beans.factory.annotation.Autowired;
4949
import org.springframework.data.annotation.*;
@@ -56,9 +56,8 @@
5656
import java.time.Instant;
5757
import java.util.*;
5858

59+
import static org.hamcrest.MatcherAssert.assertThat;
5960
import static org.hamcrest.Matchers.*;
60-
import static org.junit.Assert.assertEquals;
61-
import static org.junit.Assert.assertThat;
6261

6362
/**
6463
* @author Mark Vollmary
@@ -770,7 +769,7 @@ public void readMapInMapWithArray() {
770769
Map<String, Object> nestedResult = (Map<String, Object>) find.get().value.get("nested");
771770
assertThat(nestedResult.size(), is(1));
772771
assertThat(((List<String>) nestedResult.get("key1")).size(), is(2));
773-
assertEquals(Arrays.asList(nestedArray), nestedResult.get("key1"));
772+
assertThat(nestedResult.get("key1"), is(Arrays.asList(nestedArray)));
774773
}
775774

776775
@Test
@@ -788,6 +787,6 @@ public void readMapInMapWithCollection() {
788787
Map<String, Object> nestedResult = (Map<String, Object>) find.get().value.get("nested");
789788
assertThat(nestedResult.size(), is(1));
790789
assertThat(((List<String>) nestedResult.get("key1")).size(), is(2));
791-
assertEquals(nestedCollection, nestedResult.get("key1"));
790+
assertThat(nestedResult.get("key1"), is(nestedCollection));
792791
}
793792
}

src/test/java/com/arangodb/springframework/core/mapping/InheritanceMappingTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,17 @@
2020

2121
package com.arangodb.springframework.core.mapping;
2222

23+
import static org.hamcrest.MatcherAssert.assertThat;
2324
import static org.hamcrest.Matchers.instanceOf;
2425
import static org.hamcrest.Matchers.is;
2526
import static org.hamcrest.Matchers.notNullValue;
26-
import static org.junit.Assert.assertThat;
2727

2828
import java.util.ArrayList;
2929
import java.util.HashMap;
3030
import java.util.List;
3131
import java.util.Map;
3232

33-
import org.junit.Test;
33+
import org.junit.jupiter.api.Test;
3434

3535
import com.arangodb.springframework.AbstractArangoTest;
3636
import com.arangodb.springframework.ArangoTestConfiguration;

src/test/java/com/arangodb/springframework/core/mapping/MultiTenancyCollectionLevelMappingTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@
2020

2121
package com.arangodb.springframework.core.mapping;
2222

23+
import static org.hamcrest.MatcherAssert.assertThat;
2324
import static org.hamcrest.Matchers.is;
24-
import static org.junit.Assert.assertThat;
2525

26-
import org.junit.Test;
26+
import org.junit.jupiter.api.Test;
2727
import org.springframework.beans.factory.annotation.Autowired;
2828

2929
import com.arangodb.springframework.AbstractArangoTest;

src/test/java/com/arangodb/springframework/core/mapping/MultiTenancyDBLevelMappingTest.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,16 @@
2020

2121
package com.arangodb.springframework.core.mapping;
2222

23+
import static org.hamcrest.MatcherAssert.assertThat;
2324
import static org.hamcrest.Matchers.is;
24-
import static org.junit.Assert.assertThat;
2525

26-
import org.junit.After;
27-
import org.junit.Before;
28-
import org.junit.Test;
29-
import org.junit.runner.RunWith;
26+
import org.junit.jupiter.api.AfterEach;
27+
import org.junit.jupiter.api.BeforeEach;
28+
import org.junit.jupiter.api.Test;
29+
import org.junit.jupiter.api.extension.ExtendWith;
3030
import org.springframework.beans.factory.annotation.Autowired;
3131
import org.springframework.test.context.ContextConfiguration;
32-
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
32+
import org.springframework.test.context.junit.jupiter.SpringExtension;
3333

3434
import com.arangodb.springframework.ArangoMultiTenancyTestConfiguration;
3535
import com.arangodb.springframework.annotation.Document;
@@ -40,7 +40,7 @@
4040
* @author Mark Vollmary
4141
*
4242
*/
43-
@RunWith(SpringJUnit4ClassRunner.class)
43+
@ExtendWith(SpringExtension.class)
4444
@ContextConfiguration(classes = { ArangoMultiTenancyTestConfiguration.class })
4545
public class MultiTenancyDBLevelMappingTest {
4646

@@ -82,8 +82,8 @@ public void dbAndCollectionLevel() {
8282
is(1L));
8383
}
8484

85-
@Before
86-
@After
85+
@BeforeEach
86+
@AfterEach
8787
public void cleanup() {
8888
tenantProvider.setId(TENANT00);
8989
template.dropDatabase();

src/test/java/com/arangodb/springframework/core/mapping/MultiTenancyDBLevelRepositoryTest.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,19 @@
2020

2121
package com.arangodb.springframework.core.mapping;
2222

23+
import static org.hamcrest.MatcherAssert.assertThat;
2324
import static org.hamcrest.Matchers.is;
24-
import static org.junit.Assert.assertThat;
2525

2626
import java.util.Optional;
2727

28-
import org.junit.After;
29-
import org.junit.Before;
30-
import org.junit.Test;
31-
import org.junit.runner.RunWith;
28+
import org.junit.jupiter.api.AfterEach;
29+
import org.junit.jupiter.api.BeforeEach;
30+
import org.junit.jupiter.api.Test;
31+
import org.junit.jupiter.api.extension.ExtendWith;
3232
import org.springframework.beans.factory.annotation.Autowired;
3333
import org.springframework.data.domain.Example;
3434
import org.springframework.test.context.ContextConfiguration;
35-
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
35+
import org.springframework.test.context.junit.jupiter.SpringExtension;
3636

3737
import com.arangodb.springframework.ArangoMultiTenancyRepositoryTestConfiguration;
3838
import com.arangodb.springframework.component.TenantProvider;
@@ -44,7 +44,7 @@
4444
* @author Paulo Ferreira
4545
*
4646
*/
47-
@RunWith(SpringJUnit4ClassRunner.class)
47+
@ExtendWith(SpringExtension.class)
4848
@ContextConfiguration(classes = { ArangoMultiTenancyRepositoryTestConfiguration.class })
4949
public class MultiTenancyDBLevelRepositoryTest {
5050

@@ -79,8 +79,8 @@ public void dbFindOne() {
7979
assertThat(result.isPresent(), is(false));
8080
}
8181

82-
@Before
83-
@After
82+
@BeforeEach
83+
@AfterEach
8484
public void cleanup() {
8585
tenantProvider.setId(TENANT00);
8686
template.dropDatabase();

0 commit comments

Comments
 (0)
0