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,12 +15,12 @@
*/
package demo.cdplayer;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.not;
import static org.hamcrest.Matchers.startsWith;
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.List;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
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;
@@ -269,7 +269,7 @@ public class CdPlayerTests {
}
@SuppressWarnings("unchecked")
@Before
@BeforeEach
public void setup() throws Exception {
context = new AnnotationConfigApplicationContext();
context.register(CommonConfiguration.class, Application.class, TestConfig.class);
@@ -282,7 +282,7 @@ public class CdPlayerTests {
assertThat(listener.stateMachineStartedLatch.await(2, TimeUnit.SECONDS), is(true));
}
@After
@AfterEach
public void clean() {
doStopAndAssert(machine);
context.close();