Refactor to junit5

- remove junit4 dependecies
- refactor the unit tests by junit5
- enhance the spring-statemachine-test and spring-statemachine-build-tests so they can work together with junit4/junit5
- relates #779
This commit is contained in:
Ming Deng
2019-05-27 08:34:42 +01:00
committed by Janne Valkealahti
parent edb76476a6
commit 9f10700da2
135 changed files with 609 additions and 563 deletions

View File

@@ -15,9 +15,9 @@
*/
package demo.tasks;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThat;
import static org.springframework.statemachine.TestUtils.doStartAndAssert;
import static org.springframework.statemachine.TestUtils.doStopAndAssert;
@@ -29,9 +29,9 @@ import java.util.concurrent.TimeUnit;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
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;
@@ -138,7 +138,7 @@ public class TasksTests {
}
@SuppressWarnings("unchecked")
@Before
@BeforeEach
public void setup() throws Exception {
context = new AnnotationConfigApplicationContext();
context.register(CommonConfiguration.class, Application.class, TestConfig.class);
@@ -152,7 +152,7 @@ public class TasksTests {
assertThat(machine.getState().getIds(), contains(States.READY));
}
@After
@AfterEach
public void clean() {
doStopAndAssert(machine);
context.close();