Skip to content

Commit

Permalink
move to junit 5
Browse files Browse the repository at this point in the history
  • Loading branch information
aburmeis committed Aug 2, 2023
1 parent 59ee282 commit 4419b52
Show file tree
Hide file tree
Showing 34 changed files with 289 additions and 335 deletions.
4 changes: 0 additions & 4 deletions integration-tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,6 @@
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId>
</dependency>
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,19 @@

package com.arangodb.springframework;

import org.junit.AfterClass;
import org.junit.Before;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.junit.jupiter.SpringExtension;

import com.arangodb.springframework.core.ArangoOperations;

/**
* @author Mark Vollmary
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ExtendWith(SpringExtension.class)
@ContextConfiguration(classes = { ArangoTestConfiguration.class })
public abstract class AbstractArangoTest {

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

@Before
@BeforeEach
public void before() {
for (final Class<?> collection : collections) {
template.collection(collection).truncate();
}
AbstractArangoTest.staticTemplate = template;
}

@AfterClass
@AfterAll
public static void afterClass() {
staticTemplate.dropDatabase();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@

package com.arangodb.springframework.core.mapping;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.nullValue;
import static org.junit.Assert.assertThat;

import java.util.Optional;

import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.core.convert.converter.Converter;

import com.arangodb.entity.BaseDocument;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@

package com.arangodb.springframework.core.mapping;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.notNullValue;
import static org.junit.Assert.assertThat;

import org.junit.Test;
import org.junit.jupiter.api.Test;

import com.arangodb.springframework.AbstractArangoTest;
import com.arangodb.springframework.annotation.From;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,18 @@

package com.arangodb.springframework.core.mapping;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.hasItems;
import static org.hamcrest.Matchers.instanceOf;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.isOneOf;
import static org.hamcrest.Matchers.oneOf;
import static org.hamcrest.Matchers.notNullValue;
import static org.junit.Assert.assertThat;

import java.util.Collection;
import java.util.Set;
import java.util.stream.Collectors;

import org.junit.Test;
import org.junit.jupiter.api.Test;

import com.arangodb.springframework.AbstractArangoTest;
import com.arangodb.springframework.annotation.From;
Expand Down Expand Up @@ -67,7 +67,7 @@ public void documentFrom() {
for (final BasicEdgeLazyTestEntity e : document.entities) {
assertThat(e, instanceOf(BasicEdgeLazyTestEntity.class));
assertThat(e.getId(), is(notNullValue()));
assertThat(e.getId(), is(isOneOf(edge0.getId(), edge1.getId())));
assertThat(e.getId(), is(oneOf(edge0.getId(), edge1.getId())));
assertThat(e.getFrom(), is(notNullValue()));
assertThat(e.getFrom().getId(), is(notNullValue()));
assertThat(e.getFrom().getId(), is(e0.getId()));
Expand Down Expand Up @@ -96,7 +96,7 @@ public void documentFromLazy() {
for (final BasicEdgeLazyTestEntity e : document.entities) {
assertThat(e, instanceOf(BasicEdgeLazyTestEntity.class));
assertThat(e.getId(), is(notNullValue()));
assertThat(e.getId(), is(isOneOf(edge0.getId(), edge1.getId())));
assertThat(e.getId(), is(oneOf(edge0.getId(), edge1.getId())));
assertThat(e.getFrom(), is(notNullValue()));
assertThat(e.getFrom().getId(), is(notNullValue()));
assertThat(e.getFrom().getId(), is(e0.getId()));
Expand Down Expand Up @@ -125,7 +125,7 @@ public void documentFromLazySet() {
for (final BasicEdgeLazyTestEntity e : document.entities) {
assertThat(e, instanceOf(BasicEdgeLazyTestEntity.class));
assertThat(e.getId(), is(notNullValue()));
assertThat(e.getId(), is(isOneOf(edge0.getId(), edge1.getId())));
assertThat(e.getId(), is(oneOf(edge0.getId(), edge1.getId())));
assertThat(e.getFrom(), is(notNullValue()));
assertThat(e.getFrom().getId(), is(notNullValue()));
assertThat(e.getFrom().getId(), is(e0.getId()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
import org.joda.time.DateTimeZone;
import org.json.JSONException;
import org.json.JSONObject;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.skyscreamer.jsonassert.JSONAssert;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.annotation.*;
Expand All @@ -56,9 +56,8 @@
import java.time.Instant;
import java.util.*;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.*;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat;

/**
* @author Mark Vollmary
Expand Down Expand Up @@ -770,7 +769,7 @@ public void readMapInMapWithArray() {
Map<String, Object> nestedResult = (Map<String, Object>) find.get().value.get("nested");
assertThat(nestedResult.size(), is(1));
assertThat(((List<String>) nestedResult.get("key1")).size(), is(2));
assertEquals(Arrays.asList(nestedArray), nestedResult.get("key1"));
assertThat(nestedResult.get("key1"), is(Arrays.asList(nestedArray)));
}

@Test
Expand All @@ -788,6 +787,6 @@ public void readMapInMapWithCollection() {
Map<String, Object> nestedResult = (Map<String, Object>) find.get().value.get("nested");
assertThat(nestedResult.size(), is(1));
assertThat(((List<String>) nestedResult.get("key1")).size(), is(2));
assertEquals(nestedCollection, nestedResult.get("key1"));
assertThat(nestedResult.get("key1"), is(nestedCollection));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,17 @@

package com.arangodb.springframework.core.mapping;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.instanceOf;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.notNullValue;
import static org.junit.Assert.assertThat;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.junit.Test;
import org.junit.jupiter.api.Test;

import com.arangodb.springframework.AbstractArangoTest;
import com.arangodb.springframework.ArangoTestConfiguration;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@

package com.arangodb.springframework.core.mapping;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThat;

import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;

import com.arangodb.springframework.AbstractArangoTest;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@

package com.arangodb.springframework.core.mapping;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThat;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.AfterEach;
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.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.junit.jupiter.SpringExtension;

import com.arangodb.springframework.ArangoMultiTenancyTestConfiguration;
import com.arangodb.springframework.annotation.Document;
Expand All @@ -40,7 +40,7 @@
* @author Mark Vollmary
*
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ExtendWith(SpringExtension.class)
@ContextConfiguration(classes = { ArangoMultiTenancyTestConfiguration.class })
public class MultiTenancyDBLevelMappingTest {

Expand Down Expand Up @@ -82,8 +82,8 @@ public void dbAndCollectionLevel() {
is(1L));
}

@Before
@After
@BeforeEach
@AfterEach
public void cleanup() {
tenantProvider.setId(TENANT00);
template.dropDatabase();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,19 @@

package com.arangodb.springframework.core.mapping;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThat;

import java.util.Optional;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.AfterEach;
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.data.domain.Example;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.junit.jupiter.SpringExtension;

import com.arangodb.springframework.ArangoMultiTenancyRepositoryTestConfiguration;
import com.arangodb.springframework.component.TenantProvider;
Expand All @@ -44,7 +44,7 @@
* @author Paulo Ferreira
*
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ExtendWith(SpringExtension.class)
@ContextConfiguration(classes = { ArangoMultiTenancyRepositoryTestConfiguration.class })
public class MultiTenancyDBLevelRepositoryTest {

Expand Down Expand Up @@ -79,8 +79,8 @@ public void dbFindOne() {
assertThat(result.isPresent(), is(false));
}

@Before
@After
@BeforeEach
@AfterEach
public void cleanup() {
tenantProvider.setId(TENANT00);
template.dropDatabase();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@

package com.arangodb.springframework.core.mapping;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.hasItems;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.notNullValue;
import static org.junit.Assert.assertThat;

import java.util.ArrayList;
import java.util.Arrays;
Expand All @@ -34,7 +34,7 @@
import java.util.Optional;
import java.util.stream.Collectors;

import org.junit.Test;
import org.junit.jupiter.api.Test;

import com.arangodb.springframework.AbstractArangoTest;
import com.arangodb.springframework.annotation.Document;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,20 @@

package com.arangodb.springframework.core.mapping;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.hasItems;
import static org.hamcrest.Matchers.instanceOf;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.isOneOf;
import static org.hamcrest.Matchers.notNullValue;
import static org.junit.Assert.assertThat;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Optional;
import java.util.stream.Collectors;

import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.data.annotation.Id;

import com.arangodb.springframework.AbstractArangoTest;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,19 @@

package com.arangodb.springframework.core.mapping;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.hasItems;
import static org.hamcrest.Matchers.instanceOf;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.isOneOf;
import static org.hamcrest.Matchers.notNullValue;
import static org.junit.Assert.assertThat;

import java.util.Arrays;
import java.util.Collection;
import java.util.Set;
import java.util.stream.Collectors;

import org.junit.Test;
import org.junit.jupiter.api.Test;

import com.arangodb.springframework.AbstractArangoTest;
import com.arangodb.springframework.annotation.Relations;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,17 @@

package com.arangodb.springframework.core.mapping;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.hasItems;
import static org.hamcrest.Matchers.instanceOf;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.isOneOf;
import static org.hamcrest.Matchers.notNullValue;
import static org.junit.Assert.assertThat;

import java.util.Collection;
import java.util.stream.Collectors;

import org.junit.Test;
import org.junit.jupiter.api.Test;

import com.arangodb.springframework.AbstractArangoTest;
import com.arangodb.springframework.annotation.To;
Expand Down
Loading

0 comments on commit 4419b52

Please sign in to comment.