Upgrade Web Flow tests from JUnit 4 to 5

Replace imports:
org.junit.Assert.* -> org.junit.jupiter.api.Assertions.*
org.junit.After    -> org.junit.jupiter.api.AfterEach
org.junit.Before   -> org.junit.jupiter.api.BeforeEach

Move the `message` argument to last position.

Issue: SWF-1739
This commit is contained in:
Etienne Dysli Metref
2019-08-26 16:13:07 +02:00
committed by Rossen Stoyanchev
parent ceb44a6634
commit cadaaad605
171 changed files with 1059 additions and 1062 deletions

View File

@@ -1,17 +1,17 @@
package org.springframework.binding.collection;
import static org.junit.Assert.assertEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;
import java.util.HashMap;
import java.util.Map;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
public class MapAccessorTests {
private MapAccessor<String, Object> accessor;
@Before
@BeforeEach
public void setUp() {
Map<String, Object> map = new HashMap<>();
map.put("string", "hello");

View File

@@ -15,18 +15,18 @@
*/
package org.springframework.binding.collection;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import org.junit.Test;
import org.junit.jupiter.api.Test;
/**
* Unit tests for {@link org.springframework.binding.collection.SharedMapDecorator}.

View File

@@ -15,11 +15,11 @@
*/
package org.springframework.binding.collection;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.Collection;
import java.util.HashMap;
@@ -27,7 +27,7 @@ import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import org.junit.Test;
import org.junit.jupiter.api.Test;
/**
* Unit tests for {@link org.springframework.binding.collection.StringKeyedMapAdapter}.

View File

@@ -15,10 +15,10 @@
*/
package org.springframework.binding.convert.service;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertSame;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail;
import java.security.Principal;
import java.util.AbstractList;
@@ -32,7 +32,7 @@ import java.util.Locale;
import java.util.Set;
import java.util.StringTokenizer;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.binding.convert.ConversionException;
import org.springframework.binding.convert.ConversionExecutionException;
import org.springframework.binding.convert.ConversionExecutor;

View File

@@ -15,15 +15,15 @@
*/
package org.springframework.binding.convert.service;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertSame;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail;
import java.util.Date;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.binding.convert.ConversionExecutionException;
import org.springframework.binding.convert.converters.StringToDate;
@@ -31,7 +31,7 @@ public class StaticConversionExecutorImplTests {
private StaticConversionExecutor conversionExecutor;
@Before
@BeforeEach
public void setUp() {
StringToDate stringToDate = new StringToDate();
conversionExecutor = new StaticConversionExecutor(String.class, Date.class, stringToDate);

View File

@@ -15,13 +15,13 @@
*/
package org.springframework.binding.expression.beanwrapper;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.beans.TypeMismatchException;
import org.springframework.binding.convert.converters.StringToDate;
import org.springframework.binding.convert.service.GenericConversionService;

View File

@@ -1,7 +1,7 @@
package org.springframework.binding.expression.el;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.fail;
import java.beans.FeatureDescriptor;
import java.util.Iterator;
@@ -12,8 +12,8 @@ import javax.el.FunctionMapper;
import javax.el.VariableMapper;
import org.apache.el.ExpressionFactoryImpl;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.binding.expression.EvaluationException;
import org.springframework.binding.expression.Expression;
import org.springframework.binding.expression.ExpressionVariable;
@@ -25,7 +25,7 @@ public class ELExpressionParserTests {
private ELExpressionParser parser = new ELExpressionParser(new ExpressionFactoryImpl());
@Before
@BeforeEach
public void setUp() {
parser.putContextFactory(TestBean.class, new TestELContextFactory());
}

View File

@@ -1,22 +1,22 @@
package org.springframework.binding.expression.el;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.HashMap;
import java.util.Map;
import javax.el.ELContext;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.binding.collection.MapAdaptable;
public class MapAdaptableELResolverTests {
private ELContext context;
@Before
@BeforeEach
public void setUp() {
context = new DefaultELContext(new MapAdaptableELResolver(), null, null);
}

View File

@@ -15,12 +15,12 @@
*/
package org.springframework.binding.expression.spel;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.binding.expression.EvaluationException;
import org.springframework.binding.expression.Expression;
import org.springframework.binding.expression.ExpressionVariable;
@@ -48,7 +48,7 @@ public class ELExpressionParserCompatibilityTests {
private SpringELExpressionParser parser = new SpringELExpressionParser(new SpelExpressionParser());
@Before
@BeforeEach
public void setUp() {
parser.addPropertyAccessor(new SpecialPropertyAccessor());
}

View File

@@ -1,14 +1,14 @@
package org.springframework.binding.mapping;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertSame;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertSame;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.binding.expression.ExpressionParser;
import org.springframework.binding.expression.spel.SpringELExpressionParser;
import org.springframework.binding.mapping.impl.DefaultMapper;

View File

@@ -1,18 +1,18 @@
package org.springframework.binding.message;
import static org.junit.Assert.assertEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;
import java.io.Serializable;
import java.util.Locale;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.context.support.StaticMessageSource;
public class DefaultMessageContextTests {
private DefaultMessageContext context;
@Before
@BeforeEach
public void setUp() {
StaticMessageSource messageSource = new StaticMessageSource();
messageSource.addMessage("message", Locale.getDefault(), "Hello world resolved!");

View File

@@ -1,13 +1,13 @@
package org.springframework.binding.message;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.fail;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.fail;
import java.util.Locale;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.context.NoSuchMessageException;
import org.springframework.context.support.StaticMessageSource;
@@ -16,7 +16,7 @@ public class MessageBuilderTests {
private Locale locale = Locale.getDefault();
private MessageBuilder builder = new MessageBuilder();
@Before
@BeforeEach
public void setUp() {
messageSource.addMessage("foo", locale, "bar");
messageSource.addMessage("bar", locale, "{0}");

View File

@@ -3,8 +3,8 @@ package org.springframework.binding.message;
import java.util.Locale;
import org.easymock.EasyMock;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.context.support.StaticMessageSource;
import org.springframework.validation.MessageCodesResolver;
@@ -18,7 +18,7 @@ public class MessageContextErrorsMessageCodesTests {
private MessageCodesResolver resolver;
@Before
@BeforeEach
public void setUp() {
StaticMessageSource messageSource = new StaticMessageSource();
messageSource.addMessage(errorCode, Locale.getDefault(), "doesntmatter");

View File

@@ -1,12 +1,12 @@
package org.springframework.binding.message;
import static org.junit.Assert.assertEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;
import java.util.HashMap;
import java.util.Locale;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.binding.expression.spel.SpringELExpressionParser;
import org.springframework.context.support.StaticMessageSource;
import org.springframework.expression.spel.standard.SpelExpressionParser;
@@ -18,7 +18,7 @@ public class MessageContextErrorsTests {
private DefaultMessageContext context;
private MessageContextErrors errors;
@Before
@BeforeEach
public void setUp() {
StaticMessageSource messageSource = new StaticMessageSource();
messageSource.addMessage("foo", Locale.getDefault(), "bar");

View File

@@ -15,12 +15,12 @@
*/
package org.springframework.binding.method;
import static org.junit.Assert.assertSame;
import static org.junit.jupiter.api.Assertions.assertSame;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import org.junit.Test;
import org.junit.jupiter.api.Test;
/**
* Test case for {@link MethodInvocationException}.

View File

@@ -15,13 +15,13 @@
*/
package org.springframework.binding.method;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertSame;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.binding.expression.support.StaticExpression;
/**
@@ -34,7 +34,7 @@ public class MethodInvokerTests {
private MethodInvoker methodInvoker;
@Before
@BeforeEach
public void setUp() {
this.methodInvoker = new MethodInvoker();
}

View File

@@ -15,13 +15,13 @@
*/
package org.springframework.binding.method;
import static org.junit.Assert.assertEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;
import java.io.File;
import java.io.FilenameFilter;
import java.lang.reflect.Method;
import org.junit.Test;
import org.junit.jupiter.api.Test;
/**
* @author Rob Harrop