Consistently supply test name to @Parameters
This commit is contained in:
parent
77937c5b02
commit
572cbb0821
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2013 the original author or authors.
|
* Copyright 2002-2015 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -53,7 +53,7 @@ public class CronTriggerTests {
|
||||||
this.timeZone = timeZone;
|
this.timeZone = timeZone;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Parameters
|
@Parameters(name = "date [{0}], time zone [{1}]")
|
||||||
public static List<Object[]> getParameters() {
|
public static List<Object[]> getParameters() {
|
||||||
List<Object[]> list = new ArrayList<Object[]>();
|
List<Object[]> list = new ArrayList<Object[]>();
|
||||||
list.add(new Object[] { new Date(), TimeZone.getTimeZone("PST") });
|
list.add(new Object[] { new Date(), TimeZone.getTimeZone("PST") });
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2014 the original author or authors.
|
* Copyright 2002-2015 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -33,6 +33,7 @@ import org.springframework.test.context.TestExecutionListeners;
|
||||||
import org.springframework.test.context.support.AbstractTestExecutionListener;
|
import org.springframework.test.context.support.AbstractTestExecutionListener;
|
||||||
import org.springframework.test.context.transaction.AfterTransaction;
|
import org.springframework.test.context.transaction.AfterTransaction;
|
||||||
import org.springframework.test.context.transaction.BeforeTransaction;
|
import org.springframework.test.context.transaction.BeforeTransaction;
|
||||||
|
import org.springframework.util.ClassUtils;
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
|
|
@ -66,24 +67,24 @@ public class FailingBeforeAndAfterMethodsJUnitTests {
|
||||||
protected final Class<?> clazz;
|
protected final Class<?> clazz;
|
||||||
|
|
||||||
|
|
||||||
public FailingBeforeAndAfterMethodsJUnitTests(final Class<?> clazz) {
|
@Parameters(name = "{0}")
|
||||||
this.clazz = clazz;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Parameters
|
|
||||||
public static Collection<Object[]> testData() {
|
public static Collection<Object[]> testData() {
|
||||||
return Arrays.asList(new Object[][] {//
|
return Arrays.asList(new Object[][] {//
|
||||||
//
|
//
|
||||||
{ AlwaysFailingBeforeTestClassTestCase.class },//
|
{ AlwaysFailingBeforeTestClassTestCase.class.getSimpleName() },//
|
||||||
{ AlwaysFailingAfterTestClassTestCase.class },//
|
{ AlwaysFailingAfterTestClassTestCase.class.getSimpleName() },//
|
||||||
{ AlwaysFailingPrepareTestInstanceTestCase.class },//
|
{ AlwaysFailingPrepareTestInstanceTestCase.class.getSimpleName() },//
|
||||||
{ AlwaysFailingBeforeTestMethodTestCase.class },//
|
{ AlwaysFailingBeforeTestMethodTestCase.class.getSimpleName() },//
|
||||||
{ AlwaysFailingAfterTestMethodTestCase.class },//
|
{ AlwaysFailingAfterTestMethodTestCase.class.getSimpleName() },//
|
||||||
{ FailingBeforeTransactionTestCase.class },//
|
{ FailingBeforeTransactionTestCase.class.getSimpleName() },//
|
||||||
{ FailingAfterTransactionTestCase.class } //
|
{ FailingAfterTransactionTestCase.class.getSimpleName() } //
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public FailingBeforeAndAfterMethodsJUnitTests(String testClassName) throws Exception {
|
||||||
|
this.clazz = ClassUtils.forName(getClass().getName() + "." + testClassName, getClass().getClassLoader());
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void runTestAndAssertCounters() throws Exception {
|
public void runTestAndAssertCounters() throws Exception {
|
||||||
final TrackingRunListener listener = new TrackingRunListener();
|
final TrackingRunListener listener = new TrackingRunListener();
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,7 @@ import org.springframework.test.context.testng.AbstractTransactionalTestNGSpring
|
||||||
import org.springframework.test.context.testng.TrackingTestNGTestListener;
|
import org.springframework.test.context.testng.TrackingTestNGTestListener;
|
||||||
import org.springframework.test.context.transaction.AfterTransaction;
|
import org.springframework.test.context.transaction.AfterTransaction;
|
||||||
import org.springframework.test.context.transaction.BeforeTransaction;
|
import org.springframework.test.context.transaction.BeforeTransaction;
|
||||||
|
import org.springframework.util.ClassUtils;
|
||||||
|
|
||||||
import org.testng.TestNG;
|
import org.testng.TestNG;
|
||||||
|
|
||||||
|
|
@ -73,30 +74,29 @@ public class FailingBeforeAndAfterMethodsTestNGTests {
|
||||||
protected final int expectedFailedConfigurationsCount;
|
protected final int expectedFailedConfigurationsCount;
|
||||||
|
|
||||||
|
|
||||||
public FailingBeforeAndAfterMethodsTestNGTests(final Class<?> clazz, final int expectedTestStartCount,
|
@Parameters(name = "{0}")
|
||||||
final int expectedTestSuccessCount, final int expectedFailureCount,
|
public static Collection<Object[]> testData() {
|
||||||
final int expectedFailedConfigurationsCount) {
|
return Arrays.asList(new Object[][] {//
|
||||||
this.clazz = clazz;
|
//
|
||||||
|
{ AlwaysFailingBeforeTestClassTestCase.class.getSimpleName(), 1, 0, 0, 1 },//
|
||||||
|
{ AlwaysFailingAfterTestClassTestCase.class.getSimpleName(), 1, 1, 0, 1 },//
|
||||||
|
{ AlwaysFailingPrepareTestInstanceTestCase.class.getSimpleName(), 1, 0, 0, 1 },//
|
||||||
|
{ AlwaysFailingBeforeTestMethodTestCase.class.getSimpleName(), 1, 0, 0, 1 },//
|
||||||
|
{ AlwaysFailingAfterTestMethodTestCase.class.getSimpleName(), 1, 1, 0, 1 },//
|
||||||
|
{ FailingBeforeTransactionTestCase.class.getSimpleName(), 1, 0, 0, 1 },//
|
||||||
|
{ FailingAfterTransactionTestCase.class.getSimpleName(), 1, 1, 0, 1 } //
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public FailingBeforeAndAfterMethodsTestNGTests(String testClassName, int expectedTestStartCount,
|
||||||
|
int expectedTestSuccessCount, int expectedFailureCount, int expectedFailedConfigurationsCount) throws Exception {
|
||||||
|
this.clazz = ClassUtils.forName(getClass().getName() + "." + testClassName, getClass().getClassLoader());
|
||||||
this.expectedTestStartCount = expectedTestStartCount;
|
this.expectedTestStartCount = expectedTestStartCount;
|
||||||
this.expectedTestSuccessCount = expectedTestSuccessCount;
|
this.expectedTestSuccessCount = expectedTestSuccessCount;
|
||||||
this.expectedFailureCount = expectedFailureCount;
|
this.expectedFailureCount = expectedFailureCount;
|
||||||
this.expectedFailedConfigurationsCount = expectedFailedConfigurationsCount;
|
this.expectedFailedConfigurationsCount = expectedFailedConfigurationsCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Parameters
|
|
||||||
public static Collection<Object[]> testData() {
|
|
||||||
return Arrays.asList(new Object[][] {//
|
|
||||||
//
|
|
||||||
{ AlwaysFailingBeforeTestClassTestCase.class, 1, 0, 0, 1 },//
|
|
||||||
{ AlwaysFailingAfterTestClassTestCase.class, 1, 1, 0, 1 },//
|
|
||||||
{ AlwaysFailingPrepareTestInstanceTestCase.class, 1, 0, 0, 1 },//
|
|
||||||
{ AlwaysFailingBeforeTestMethodTestCase.class, 1, 0, 0, 1 },//
|
|
||||||
{ AlwaysFailingAfterTestMethodTestCase.class, 1, 1, 0, 1 },//
|
|
||||||
{ FailingBeforeTransactionTestCase.class, 1, 0, 0, 1 },//
|
|
||||||
{ FailingAfterTransactionTestCase.class, 1, 1, 0, 1 } //
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void runTestAndAssertCounters() throws Exception {
|
public void runTestAndAssertCounters() throws Exception {
|
||||||
final TrackingTestNGTestListener listener = new TrackingTestNGTestListener();
|
final TrackingTestNGTestListener listener = new TrackingTestNGTestListener();
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2013 the original author or authors.
|
* Copyright 2002-2015 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -27,6 +27,7 @@ import org.junit.BeforeClass;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.junit.runners.Parameterized;
|
import org.junit.runners.Parameterized;
|
||||||
|
import org.junit.runners.Parameterized.Parameter;
|
||||||
import org.junit.runners.Parameterized.Parameters;
|
import org.junit.runners.Parameterized.Parameters;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
@ -58,26 +59,22 @@ public class ParameterizedDependencyInjectionTests {
|
||||||
|
|
||||||
private static final List<Employee> employees = new ArrayList<Employee>();
|
private static final List<Employee> employees = new ArrayList<Employee>();
|
||||||
|
|
||||||
|
private final TestContextManager testContextManager = new TestContextManager(getClass());
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ApplicationContext applicationContext;
|
private ApplicationContext applicationContext;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private Pet pet;
|
private Pet pet;
|
||||||
|
|
||||||
private final String employeeBeanName;
|
@Parameter(0)
|
||||||
private final String employeeName;
|
public String employeeBeanName;
|
||||||
|
|
||||||
private final TestContextManager testContextManager;
|
@Parameter(1)
|
||||||
|
public String employeeName;
|
||||||
|
|
||||||
|
|
||||||
public ParameterizedDependencyInjectionTests(final String employeeBeanName, final String employeeName)
|
@Parameters(name = "bean [{0}], employee [{1}]")
|
||||||
throws Exception {
|
|
||||||
this.testContextManager = new TestContextManager(getClass());
|
|
||||||
this.employeeBeanName = employeeBeanName;
|
|
||||||
this.employeeName = employeeName;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Parameters
|
|
||||||
public static Collection<String[]> employeeData() {
|
public static Collection<String[]> employeeData() {
|
||||||
return Arrays.asList(new String[][] { { "employee1", "John Smith" }, { "employee2", "Jane Smith" } });
|
return Arrays.asList(new String[][] { { "employee1", "John Smith" }, { "employee2", "Jane Smith" } });
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2013 the original author or authors.
|
* Copyright 2002-2015 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -33,6 +33,7 @@ import org.junit.runners.Parameterized.Parameters;
|
||||||
import org.springframework.test.annotation.Repeat;
|
import org.springframework.test.annotation.Repeat;
|
||||||
import org.springframework.test.annotation.Timed;
|
import org.springframework.test.annotation.Timed;
|
||||||
import org.springframework.test.context.TestExecutionListeners;
|
import org.springframework.test.context.TestExecutionListeners;
|
||||||
|
import org.springframework.util.ClassUtils;
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
|
|
@ -52,7 +53,7 @@ public class RepeatedSpringRunnerTests {
|
||||||
|
|
||||||
private static final AtomicInteger invocationCount = new AtomicInteger();
|
private static final AtomicInteger invocationCount = new AtomicInteger();
|
||||||
|
|
||||||
private final Class<? extends AbstractRepeatedTestCase> testClass;
|
private final Class<?> testClass;
|
||||||
|
|
||||||
private final int expectedFailureCount;
|
private final int expectedFailureCount;
|
||||||
|
|
||||||
|
|
@ -63,28 +64,28 @@ public class RepeatedSpringRunnerTests {
|
||||||
private final int expectedInvocationCount;
|
private final int expectedInvocationCount;
|
||||||
|
|
||||||
|
|
||||||
public RepeatedSpringRunnerTests(Class<? extends AbstractRepeatedTestCase> testClass, int expectedFailureCount,
|
@Parameters(name = "{0}")
|
||||||
int expectedTestStartedCount, int expectedTestFinishedCount, int expectedInvocationCount) {
|
public static Collection<Object[]> repetitionData() {
|
||||||
this.testClass = testClass;
|
return Arrays.asList(new Object[][] {//
|
||||||
|
//
|
||||||
|
{ NonAnnotatedRepeatedTestCase.class.getSimpleName(), 0, 1, 1, 1 },//
|
||||||
|
{ DefaultRepeatValueRepeatedTestCase.class.getSimpleName(), 0, 1, 1, 1 },//
|
||||||
|
{ NegativeRepeatValueRepeatedTestCase.class.getSimpleName(), 0, 1, 1, 1 },//
|
||||||
|
{ RepeatedFiveTimesRepeatedTestCase.class.getSimpleName(), 0, 1, 1, 5 },//
|
||||||
|
{ RepeatedFiveTimesViaMetaAnnotationRepeatedTestCase.class.getSimpleName(), 0, 1, 1, 5 },//
|
||||||
|
{ TimedRepeatedTestCase.class.getSimpleName(), 3, 4, 4, (5 + 1 + 4 + 10) } //
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public RepeatedSpringRunnerTests(String testClassName, int expectedFailureCount,
|
||||||
|
int expectedTestStartedCount, int expectedTestFinishedCount, int expectedInvocationCount) throws Exception {
|
||||||
|
this.testClass = ClassUtils.forName(getClass().getName() + "." + testClassName, getClass().getClassLoader());
|
||||||
this.expectedFailureCount = expectedFailureCount;
|
this.expectedFailureCount = expectedFailureCount;
|
||||||
this.expectedTestStartedCount = expectedTestStartedCount;
|
this.expectedTestStartedCount = expectedTestStartedCount;
|
||||||
this.expectedTestFinishedCount = expectedTestFinishedCount;
|
this.expectedTestFinishedCount = expectedTestFinishedCount;
|
||||||
this.expectedInvocationCount = expectedInvocationCount;
|
this.expectedInvocationCount = expectedInvocationCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Parameters
|
|
||||||
public static Collection<Object[]> repetitionData() {
|
|
||||||
return Arrays.asList(new Object[][] {//
|
|
||||||
//
|
|
||||||
{ NonAnnotatedRepeatedTestCase.class, 0, 1, 1, 1 },//
|
|
||||||
{ DefaultRepeatValueRepeatedTestCase.class, 0, 1, 1, 1 },//
|
|
||||||
{ NegativeRepeatValueRepeatedTestCase.class, 0, 1, 1, 1 },//
|
|
||||||
{ RepeatedFiveTimesRepeatedTestCase.class, 0, 1, 1, 5 },//
|
|
||||||
{ RepeatedFiveTimesViaMetaAnnotationRepeatedTestCase.class, 0, 1, 1, 5 },//
|
|
||||||
{ TimedRepeatedTestCase.class, 3, 4, 4, (5 + 1 + 4 + 10) } //
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void assertRepetitions() throws Exception {
|
public void assertRepetitions() throws Exception {
|
||||||
TrackingRunListener listener = new TrackingRunListener();
|
TrackingRunListener listener = new TrackingRunListener();
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2014 the original author or authors.
|
* Copyright 2002-2015 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -25,10 +25,10 @@ import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.junit.runners.Parameterized;
|
import org.junit.runners.Parameterized;
|
||||||
import org.junit.runners.Parameterized.Parameters;
|
import org.junit.runners.Parameterized.Parameters;
|
||||||
|
|
||||||
import org.springframework.core.annotation.AnnotationUtils;
|
import org.springframework.core.annotation.AnnotationUtils;
|
||||||
import org.springframework.test.context.ContextConfiguration;
|
import org.springframework.test.context.ContextConfiguration;
|
||||||
import org.springframework.test.context.ContextLoader;
|
import org.springframework.test.context.ContextLoader;
|
||||||
|
import org.springframework.util.ClassUtils;
|
||||||
import org.springframework.util.ObjectUtils;
|
import org.springframework.util.ObjectUtils;
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
import static org.junit.Assert.*;
|
||||||
|
|
@ -55,12 +55,7 @@ public class GenericXmlContextLoaderResourceLocationsTests {
|
||||||
protected final String[] expectedLocations;
|
protected final String[] expectedLocations;
|
||||||
|
|
||||||
|
|
||||||
public GenericXmlContextLoaderResourceLocationsTests(final Class<?> testClass, final String[] expectedLocations) {
|
@Parameters(name = "{0}")
|
||||||
this.testClass = testClass;
|
|
||||||
this.expectedLocations = expectedLocations;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Parameters
|
|
||||||
public static Collection<Object[]> contextConfigurationLocationsData() {
|
public static Collection<Object[]> contextConfigurationLocationsData() {
|
||||||
@ContextConfiguration
|
@ContextConfiguration
|
||||||
class ClasspathNonExistentDefaultLocationsTestCase {
|
class ClasspathNonExistentDefaultLocationsTestCase {
|
||||||
|
|
@ -93,25 +88,25 @@ public class GenericXmlContextLoaderResourceLocationsTests {
|
||||||
|
|
||||||
return Arrays.asList(new Object[][] {
|
return Arrays.asList(new Object[][] {
|
||||||
|
|
||||||
{ ClasspathNonExistentDefaultLocationsTestCase.class, new String[] {} },
|
{ ClasspathNonExistentDefaultLocationsTestCase.class.getSimpleName(), new String[] {} },
|
||||||
|
|
||||||
{
|
{
|
||||||
ClasspathExistentDefaultLocationsTestCase.class,
|
ClasspathExistentDefaultLocationsTestCase.class.getSimpleName(),
|
||||||
new String[] { "classpath:org/springframework/test/context/support/GenericXmlContextLoaderResourceLocationsTests$1ClasspathExistentDefaultLocationsTestCase-context.xml" } },
|
new String[] { "classpath:org/springframework/test/context/support/GenericXmlContextLoaderResourceLocationsTests$1ClasspathExistentDefaultLocationsTestCase-context.xml" } },
|
||||||
|
|
||||||
{
|
{
|
||||||
ImplicitClasspathLocationsTestCase.class,
|
ImplicitClasspathLocationsTestCase.class.getSimpleName(),
|
||||||
new String[] { "classpath:/org/springframework/test/context/support/context1.xml",
|
new String[] { "classpath:/org/springframework/test/context/support/context1.xml",
|
||||||
"classpath:/org/springframework/test/context/support/context2.xml" } },
|
"classpath:/org/springframework/test/context/support/context2.xml" } },
|
||||||
|
|
||||||
{ ExplicitClasspathLocationsTestCase.class, new String[] { "classpath:context.xml" } },
|
{ ExplicitClasspathLocationsTestCase.class.getSimpleName(), new String[] { "classpath:context.xml" } },
|
||||||
|
|
||||||
{ ExplicitFileLocationsTestCase.class, new String[] { "file:/testing/directory/context.xml" } },
|
{ ExplicitFileLocationsTestCase.class.getSimpleName(), new String[] { "file:/testing/directory/context.xml" } },
|
||||||
|
|
||||||
{ ExplicitUrlLocationsTestCase.class, new String[] { "http://example.com/context.xml" } },
|
{ ExplicitUrlLocationsTestCase.class.getSimpleName(), new String[] { "http://example.com/context.xml" } },
|
||||||
|
|
||||||
{
|
{
|
||||||
ExplicitMixedPathTypesLocationsTestCase.class,
|
ExplicitMixedPathTypesLocationsTestCase.class.getSimpleName(),
|
||||||
new String[] { "classpath:/org/springframework/test/context/support/context1.xml",
|
new String[] { "classpath:/org/springframework/test/context/support/context1.xml",
|
||||||
"classpath:context2.xml", "classpath:/context3.xml", "file:/testing/directory/context.xml",
|
"classpath:context2.xml", "classpath:/context3.xml", "file:/testing/directory/context.xml",
|
||||||
"http://example.com/context.xml" } }
|
"http://example.com/context.xml" } }
|
||||||
|
|
@ -119,6 +114,11 @@ public class GenericXmlContextLoaderResourceLocationsTests {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public GenericXmlContextLoaderResourceLocationsTests(final String testClassName, final String[] expectedLocations) throws Exception {
|
||||||
|
this.testClass = ClassUtils.forName(getClass().getName() + "$1" + testClassName, getClass().getClassLoader());
|
||||||
|
this.expectedLocations = expectedLocations;
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void assertContextConfigurationLocations() throws Exception {
|
public void assertContextConfigurationLocations() throws Exception {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,8 +16,6 @@
|
||||||
|
|
||||||
package org.springframework.web.context.request;
|
package org.springframework.web.context.request;
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
|
||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
@ -27,11 +25,14 @@ import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.junit.runners.Parameterized;
|
import org.junit.runners.Parameterized;
|
||||||
|
import org.junit.runners.Parameterized.Parameter;
|
||||||
import org.junit.runners.Parameterized.Parameters;
|
import org.junit.runners.Parameterized.Parameters;
|
||||||
|
|
||||||
import org.springframework.mock.web.test.MockHttpServletRequest;
|
import org.springframework.mock.web.test.MockHttpServletRequest;
|
||||||
import org.springframework.mock.web.test.MockHttpServletResponse;
|
import org.springframework.mock.web.test.MockHttpServletResponse;
|
||||||
|
|
||||||
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parameterized tests for ServletWebRequest
|
* Parameterized tests for ServletWebRequest
|
||||||
* @author Juergen Hoeller
|
* @author Juergen Hoeller
|
||||||
|
|
@ -49,9 +50,10 @@ public class ServletWebRequestHttpMethodsTests {
|
||||||
|
|
||||||
private ServletWebRequest request;
|
private ServletWebRequest request;
|
||||||
|
|
||||||
private String method;
|
@Parameter
|
||||||
|
public String method;
|
||||||
|
|
||||||
@Parameters
|
@Parameters(name = "{0}")
|
||||||
static public Iterable<Object[]> safeMethods() {
|
static public Iterable<Object[]> safeMethods() {
|
||||||
return Arrays.asList(new Object[][] {
|
return Arrays.asList(new Object[][] {
|
||||||
{"GET"},
|
{"GET"},
|
||||||
|
|
@ -59,10 +61,6 @@ public class ServletWebRequestHttpMethodsTests {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public ServletWebRequestHttpMethodsTests(String method) {
|
|
||||||
this.method = method;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
dateFormat = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss z", Locale.US);
|
dateFormat = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss z", Locale.US);
|
||||||
|
|
|
||||||
|
|
@ -16,9 +16,6 @@
|
||||||
|
|
||||||
package org.springframework.web.socket;
|
package org.springframework.web.socket;
|
||||||
|
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
|
||||||
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
@ -29,6 +26,8 @@ import java.util.concurrent.TimeUnit;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.junit.runners.Parameterized;
|
import org.junit.runners.Parameterized;
|
||||||
|
import org.junit.runners.Parameterized.Parameters;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
@ -41,6 +40,7 @@ import org.springframework.web.socket.handler.AbstractWebSocketHandler;
|
||||||
import org.springframework.web.socket.handler.TextWebSocketHandler;
|
import org.springframework.web.socket.handler.TextWebSocketHandler;
|
||||||
import org.springframework.web.socket.server.support.DefaultHandshakeHandler;
|
import org.springframework.web.socket.server.support.DefaultHandshakeHandler;
|
||||||
|
|
||||||
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Client and server-side WebSocket integration tests.
|
* Client and server-side WebSocket integration tests.
|
||||||
|
|
@ -50,7 +50,7 @@ import org.springframework.web.socket.server.support.DefaultHandshakeHandler;
|
||||||
@RunWith(Parameterized.class)
|
@RunWith(Parameterized.class)
|
||||||
public class WebSocketIntegrationTests extends AbstractWebSocketIntegrationTests {
|
public class WebSocketIntegrationTests extends AbstractWebSocketIntegrationTests {
|
||||||
|
|
||||||
@Parameterized.Parameters
|
@Parameters(name = "server [{0}], client [{1}]")
|
||||||
public static Iterable<Object[]> arguments() {
|
public static Iterable<Object[]> arguments() {
|
||||||
return Arrays.asList(new Object[][] {
|
return Arrays.asList(new Object[][] {
|
||||||
{new JettyWebSocketTestServer(), new JettyWebSocketClient()},
|
{new JettyWebSocketTestServer(), new JettyWebSocketClient()},
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2014 the original author or authors.
|
* Copyright 2002-2015 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -49,7 +49,7 @@ import static org.junit.Assert.*;
|
||||||
@RunWith(Parameterized.class)
|
@RunWith(Parameterized.class)
|
||||||
public class WebSocketConfigurationTests extends AbstractWebSocketIntegrationTests {
|
public class WebSocketConfigurationTests extends AbstractWebSocketIntegrationTests {
|
||||||
|
|
||||||
@Parameters
|
@Parameters(name = "server [{0}], client [{1}]")
|
||||||
public static Iterable<Object[]> arguments() {
|
public static Iterable<Object[]> arguments() {
|
||||||
return Arrays.asList(new Object[][] {
|
return Arrays.asList(new Object[][] {
|
||||||
{new JettyWebSocketTestServer(), new JettyWebSocketClient()},
|
{new JettyWebSocketTestServer(), new JettyWebSocketClient()},
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2014 the original author or authors.
|
* Copyright 2002-2015 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -71,7 +71,7 @@ import static org.springframework.web.socket.messaging.StompTextMessageBuilder.*
|
||||||
@RunWith(Parameterized.class)
|
@RunWith(Parameterized.class)
|
||||||
public class StompWebSocketIntegrationTests extends AbstractWebSocketIntegrationTests {
|
public class StompWebSocketIntegrationTests extends AbstractWebSocketIntegrationTests {
|
||||||
|
|
||||||
@Parameters
|
@Parameters(name = "server [{0}], client [{1}]")
|
||||||
public static Iterable<Object[]> arguments() {
|
public static Iterable<Object[]> arguments() {
|
||||||
return Arrays.asList(new Object[][] {
|
return Arrays.asList(new Object[][] {
|
||||||
{new JettyWebSocketTestServer(), new JettyWebSocketClient()},
|
{new JettyWebSocketTestServer(), new JettyWebSocketClient()},
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue