Move to junit5 in all framework tests

- Just a migration
- Replace RedisRule with EnabledOnRedis
- Replace MongoDbRule with EnabledOnMongoDb
- spring-statemachine-test and some docs contains refs to junit4
  but those are support packages and will stay in place.
- Fixes #779
- Relates #771
This commit is contained in:
Janne Valkealahti
2019-12-24 16:52:05 +00:00
parent 0adae262c4
commit 10ce7a65a4
28 changed files with 289 additions and 161 deletions

View File

@@ -21,14 +21,12 @@ import static org.junit.Assert.assertThat;
import static org.junit.jupiter.api.Assertions.assertEquals;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Bean;
@@ -60,13 +58,13 @@ public abstract class AbstractRepositoryTests {
protected AnnotationConfigApplicationContext context;
@Before
@BeforeEach
public void setup() {
cleanInternal();
context = buildContext();
}
@After
@AfterEach
public void clean() {
if (context != null) {
context.close();
@@ -443,18 +441,18 @@ public abstract class AbstractRepositoryTests {
context.refresh();
StateMachineFactory<String, String> stateMachineFactory = context.getBean(StateMachineFactory.class);
StateMachine<String, String> stateMachine = stateMachineFactory.getStateMachine();
Map<String, State<String, String>> states = stateMachine.getStates().stream().collect(Collectors.toMap((State<String, String> s1) -> s1.getId(), s2 -> s2));
assertEquals(2, states.size());
State<String,String> S1 = (State<String, String>) states.get("S1");
assertEquals(1, S1.getExitActions().size());
State<String,String> S2 = (State<String,String>)states.get("S2");
assertEquals(1, S2.getEntryActions().size());
assertEquals(1, S2.getStateActions().size());
}
@Configuration
public static class Config2 {