Port autoconfigure tests to assertj
This commit is contained in:
@@ -256,8 +256,6 @@ project('spring-statemachine-autoconfigure') {
|
||||
testRuntime 'com.h2database:h2'
|
||||
testCompile 'org.springframework.boot:spring-boot-test'
|
||||
testCompile 'org.springframework:spring-test'
|
||||
testCompile 'org.hamcrest:hamcrest-core'
|
||||
testCompile 'org.hamcrest:hamcrest-library'
|
||||
testCompile("org.junit.jupiter:junit-jupiter-api")
|
||||
testCompile("org.junit.jupiter:junit-jupiter-engine")
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016-2017 the original author or authors.
|
||||
* Copyright 2016-2020 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -15,10 +15,7 @@
|
||||
*/
|
||||
package org.springframework.statemachine.boot;
|
||||
|
||||
import static org.hamcrest.Matchers.instanceOf;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
import static org.hamcrest.Matchers.notNullValue;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -58,7 +55,7 @@ public class StateMachineAutoConfigurationTests {
|
||||
context = new AnnotationConfigApplicationContext();
|
||||
context.register(StateMachineAutoConfiguration.class);
|
||||
context.refresh();
|
||||
assertThat(context.containsBean("bootStateMachineMonitor"), is(true));
|
||||
assertThat(context.containsBean("bootStateMachineMonitor")).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -67,7 +64,7 @@ public class StateMachineAutoConfigurationTests {
|
||||
TestPropertyValues.of("spring.statemachine.monitor.enabled=false").applyTo(context);
|
||||
context.register(StateMachineAutoConfiguration.class);
|
||||
context.refresh();
|
||||
assertThat(context.containsBean("bootStateMachineMonitor"), is(false));
|
||||
assertThat(context.containsBean("bootStateMachineMonitor")).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -79,9 +76,9 @@ public class StateMachineAutoConfigurationTests {
|
||||
Object compositeStateMachineMonitor = TestUtils.readField("stateMachineMonitor", stateMachine);
|
||||
Object orderedCompositeItem = TestUtils.readField("items", compositeStateMachineMonitor);
|
||||
List<Object> list = TestUtils.readField("list", orderedCompositeItem);
|
||||
assertThat(list, notNullValue());
|
||||
assertThat(list.size(), is(1));
|
||||
assertThat(list.get(0), instanceOf(BootStateMachineMonitor.class));
|
||||
assertThat(list).isNotNull();
|
||||
assertThat(list.size()).isEqualTo(1);
|
||||
assertThat(list.get(0)).isInstanceOf(BootStateMachineMonitor.class);
|
||||
}
|
||||
|
||||
@Configuration
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016-2017 the original author or authors.
|
||||
* Copyright 2016-2020 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -15,8 +15,7 @@
|
||||
*/
|
||||
package org.springframework.statemachine.boot;
|
||||
|
||||
import static org.hamcrest.Matchers.is;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -52,7 +51,7 @@ public class StateMachineJpaRepositoriesAutoConfigurationTests {
|
||||
StateMachineJpaRepositoriesAutoConfiguration.class);
|
||||
|
||||
context.refresh();
|
||||
assertThat(context.containsBean("jpaStateRepository"), is(true));
|
||||
assertThat(context.containsBean("jpaStateRepository")).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -61,7 +60,7 @@ public class StateMachineJpaRepositoriesAutoConfigurationTests {
|
||||
TestPropertyValues.of("spring.statemachine.data.jpa.repositories.enabled=false").applyTo(context);
|
||||
context.register(StateMachineJpaRepositoriesAutoConfiguration.class);
|
||||
context.refresh();
|
||||
assertThat(context.containsBean("jpaStateRepository"), is(false));
|
||||
assertThat(context.containsBean("jpaStateRepository")).isFalse();
|
||||
}
|
||||
|
||||
@Configuration
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016-2017 the original author or authors.
|
||||
* Copyright 2016-2020 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -15,8 +15,7 @@
|
||||
*/
|
||||
package org.springframework.statemachine.boot;
|
||||
|
||||
import static org.hamcrest.Matchers.is;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -53,7 +52,7 @@ public class StateMachineMongoDbRepositoriesAutoConfigurationTests {
|
||||
StateMachineMongoDbRepositoriesAutoConfiguration.class);
|
||||
|
||||
context.refresh();
|
||||
assertThat(context.containsBean("mongoDbStateRepository"), is(true));
|
||||
assertThat(context.containsBean("mongoDbStateRepository")).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -62,7 +61,7 @@ public class StateMachineMongoDbRepositoriesAutoConfigurationTests {
|
||||
TestPropertyValues.of("spring.statemachine.data.redis.repositories.enabled=false").applyTo(context);
|
||||
context.register(StateMachineRedisRepositoriesAutoConfiguration.class);
|
||||
context.refresh();
|
||||
assertThat(context.containsBean("mongoDbStateRepository"), is(false));
|
||||
assertThat(context.containsBean("mongoDbStateRepository")).isFalse();
|
||||
}
|
||||
|
||||
@Configuration
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016-2017 the original author or authors.
|
||||
* Copyright 2016-2020 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -15,8 +15,7 @@
|
||||
*/
|
||||
package org.springframework.statemachine.boot;
|
||||
|
||||
import static org.hamcrest.Matchers.is;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -50,7 +49,7 @@ public class StateMachineRedisRepositoriesAutoConfigurationTests {
|
||||
StateMachineRedisRepositoriesAutoConfiguration.class);
|
||||
|
||||
context.refresh();
|
||||
assertThat(context.containsBean("redisStateRepository"), is(true));
|
||||
assertThat(context.containsBean("redisStateRepository")).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -59,7 +58,7 @@ public class StateMachineRedisRepositoriesAutoConfigurationTests {
|
||||
TestPropertyValues.of("spring.statemachine.data.redis.repositories.enabled=false").applyTo(context);
|
||||
context.register(StateMachineRedisRepositoriesAutoConfiguration.class);
|
||||
context.refresh();
|
||||
assertThat(context.containsBean("redisStateRepository"), is(false));
|
||||
assertThat(context.containsBean("redisStateRepository")).isFalse();
|
||||
}
|
||||
|
||||
@Configuration
|
||||
|
||||
Reference in New Issue
Block a user