fix sonar issues (#6394)
This commit is contained in:
parent
07b62fd912
commit
e506bc1d75
|
@ -64,11 +64,11 @@ public class ForkJoinStateMachineConfiguration extends StateMachineConfigurerAda
|
|||
|
||||
@Bean
|
||||
public Guard<String, String> mediumGuard() {
|
||||
return (ctx) -> false;
|
||||
return ctx -> false;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Guard<String, String> highGuard() {
|
||||
return (ctx) -> false;
|
||||
return ctx -> false;
|
||||
}
|
||||
}
|
|
@ -50,11 +50,11 @@ public class JunctionStateMachineConfiguration extends StateMachineConfigurerAda
|
|||
|
||||
@Bean
|
||||
public Guard<String, String> mediumGuard() {
|
||||
return (ctx) -> false;
|
||||
return ctx -> false;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Guard<String, String> highGuard() {
|
||||
return (ctx) -> false;
|
||||
return ctx -> false;
|
||||
}
|
||||
}
|
|
@ -18,7 +18,7 @@ import java.util.logging.Logger;
|
|||
@EnableStateMachine
|
||||
public class SimpleStateMachineConfiguration extends StateMachineConfigurerAdapter<String, String> {
|
||||
|
||||
public static final Logger LOGGER = Logger.getLogger(SimpleStateMachineConfiguration.class.getName());
|
||||
private static final Logger LOGGER = Logger.getLogger(SimpleStateMachineConfiguration.class.getName());
|
||||
|
||||
@Override
|
||||
public void configure(StateMachineConfigurationConfigurer<String, String> config) throws Exception {
|
||||
|
@ -80,7 +80,7 @@ public class SimpleStateMachineConfiguration extends StateMachineConfigurerAdapt
|
|||
|
||||
@Bean
|
||||
public Guard<String, String> simpleGuard() {
|
||||
return (ctx) -> {
|
||||
return ctx -> {
|
||||
int approvalCount = (int) ctx
|
||||
.getExtendedState()
|
||||
.getVariables()
|
||||
|
|
|
@ -7,10 +7,10 @@ import java.util.logging.Logger;
|
|||
|
||||
public class StateMachineListener extends StateMachineListenerAdapter {
|
||||
|
||||
public static final Logger LOGGER = Logger.getLogger(StateMachineListener.class.getName());
|
||||
private static final Logger LOGGER = Logger.getLogger(StateMachineListener.class.getName());
|
||||
|
||||
@Override
|
||||
public void stateChanged(State from, State to) {
|
||||
LOGGER.info(String.format("Transitioned from %s to %s%n", from == null ? "none" : from.getId(), to.getId()));
|
||||
LOGGER.info(() -> String.format("Transitioned from %s to %s%n", from == null ? "none" : from.getId(), to.getId()));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,18 +1,15 @@
|
|||
package com.baeldung.spring.statemachine;
|
||||
|
||||
import com.baeldung.spring.statemachine.config.ForkJoinStateMachineConfiguration;
|
||||
import com.baeldung.spring.statemachine.config.JunctionStateMachineConfiguration;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
import org.springframework.statemachine.StateMachine;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Arrays;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
|
|
@ -1,18 +1,15 @@
|
|||
package com.baeldung.spring.statemachine;
|
||||
|
||||
import com.baeldung.spring.statemachine.config.HierarchicalStateMachineConfiguration;
|
||||
import com.baeldung.spring.statemachine.config.JunctionStateMachineConfiguration;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
import org.springframework.statemachine.StateMachine;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Arrays;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
|
|
@ -1,20 +1,16 @@
|
|||
package com.baeldung.spring.statemachine;
|
||||
|
||||
import com.baeldung.spring.statemachine.config.JunctionStateMachineConfiguration;
|
||||
import com.baeldung.spring.statemachine.config.SimpleEnumStateMachineConfiguration;
|
||||
import org.junit.After;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
import org.springframework.statemachine.StateMachine;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration(classes = JunctionStateMachineConfiguration.class)
|
||||
public class JunctionStateMachineIntegrationTest {
|
||||
|
|
|
@ -3,19 +3,15 @@ package com.baeldung.spring.statemachine;
|
|||
import com.baeldung.spring.statemachine.applicationreview.ApplicationReviewEvents;
|
||||
import com.baeldung.spring.statemachine.applicationreview.ApplicationReviewStates;
|
||||
import com.baeldung.spring.statemachine.config.SimpleEnumStateMachineConfiguration;
|
||||
import com.baeldung.spring.statemachine.config.SimpleStateMachineConfiguration;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
import org.springframework.statemachine.StateMachine;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
package com.baeldung.spring.statemachine;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.springframework.statemachine.StateMachine;
|
||||
import org.springframework.statemachine.config.StateMachineBuilder;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
public class StateMachineBuilderIntegrationTest {
|
||||
|
||||
@Test
|
||||
|
|
|
@ -1,22 +1,17 @@
|
|||
package com.baeldung.spring.statemachine;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import com.baeldung.spring.statemachine.config.SimpleStateMachineConfiguration;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
import org.springframework.statemachine.StateMachine;
|
||||
|
||||
import com.baeldung.spring.statemachine.config.SimpleStateMachineConfiguration;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration(classes = SimpleStateMachineConfiguration.class)
|
||||
|
@ -42,7 +37,7 @@ public class StateMachineIntegrationTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void whenSimpleStringMachineActionState_thenActionExecuted() throws InterruptedException {
|
||||
public void whenSimpleStringMachineActionState_thenActionExecuted() {
|
||||
|
||||
stateMachine.sendEvent("E3");
|
||||
assertEquals("S3", stateMachine.getState().getId());
|
||||
|
|
Loading…
Reference in New Issue