提交 56774baa 编写于 作者: S Sam Brannen

Use Gradle 4.6's built-in support for the JUnit Platform

Gradle 4.6 provides built-in support for the JUnit Platform within the
standard `test` task.

This commit configures a custom `testJUnitJupiter` test task for
executing JUnit Jupiter tests directly on the JUnit Platform instead of
indirectly on JUnit 4 via @RunWith(JUnitPlatform.class).

This switch provides for better integration with Gradle's test reporting
and paves the way for a possible transition to the JUnit Platform in the
future.

Issue: SPR-16672
上级 aba882af
......@@ -103,22 +103,34 @@ task testNG(type: Test) {
reports.junitXml.destination = file("$buildDir/test-results")
}
task testJUnitJupiter(type: Test) {
description = 'Runs JUnit Jupiter tests.'
useJUnitPlatform {
includeEngines 'junit-jupiter'
excludeTags 'failing-test-case'
}
filter {
includeTestsMatching "org.springframework.test.context.junit.jupiter.*"
}
reports.junitXml.destination = file("$buildDir/test-results")
// Java Util Logging for the JUnit Platform.
// systemProperty('java.util.logging.manager', 'org.apache.logging.log4j.jul.LogManager')
}
test {
description = 'Runs JUnit tests.'
dependsOn testNG
dependsOn testJUnitJupiter, testNG
useJUnit()
scanForTestClasses = false
include(['**/*Tests.class', '**/*Test.class', '**/SpringJUnitJupiterTestSuite.class'])
exclude(['**/testng/**/*.*'])
// Java Util Logging for JUnit 5.
// systemProperty('java.util.logging.manager', 'org.apache.logging.log4j.jul.LogManager')
include(['**/*Tests.class', '**/*Test.class'])
exclude(['**/testng/**/*.*', '**/jupiter/**/*.*'])
reports.junitXml.destination = file("$buildDir/test-results")
}
task aggregateTestReports(type: TestReport) {
description = 'Aggregates JUnit and TestNG test reports.'
destinationDir = test.reports.html.destination
reportOn test, testNG
reportOn test, testJUnitJupiter, testNG
}
check.dependsOn aggregateTestReports
/*
* Copyright 2002-2017 the original author or authors.
* Copyright 2002-2018 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.
......@@ -17,7 +17,7 @@
package org.springframework.test.context.junit;
import org.junit.platform.runner.JUnitPlatform;
import org.junit.platform.suite.api.IncludeClassNamePatterns;
import org.junit.platform.suite.api.ExcludeTags;
import org.junit.platform.suite.api.IncludeEngines;
import org.junit.platform.suite.api.SelectPackages;
import org.junit.platform.suite.api.UseTechnicalNames;
......@@ -48,7 +48,7 @@ import org.junit.runner.RunWith;
@RunWith(JUnitPlatform.class)
@IncludeEngines("junit-jupiter")
@SelectPackages("org.springframework.test.context.junit.jupiter")
@IncludeClassNamePatterns("^.*TestCase$")
@ExcludeTags("failing-test-case")
@UseTechnicalNames
public class SpringJUnitJupiterTestSuite {
}
/*
* Copyright 2002-2017 the original author or authors.
* Copyright 2002-2018 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.
......@@ -45,11 +45,11 @@ import static org.junit.jupiter.api.Assertions.*;
* @since 5.0
* @see SpringExtension
* @see SpringJUnitConfig
* @see SpringExtensionTestCase
* @see SpringExtensionTests
*/
@SpringJUnitConfig(TestConfig.class)
@DisplayName("@SpringJUnitConfig Tests")
class ComposedSpringExtensionTestCase {
class ComposedSpringExtensionTests {
@Autowired
Person dilbert;
......
/*
* Copyright 2002-2017 the original author or authors.
* Copyright 2002-2018 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.
......@@ -40,7 +40,7 @@ import static org.mockito.Mockito.*;
/**
* Tests for {@link DisabledIfCondition} that verify actual condition evaluation
* results and exception handling; whereas, {@link DisabledIfTestCase} only tests
* results and exception handling; whereas, {@link DisabledIfTests} only tests
* the <em>happy paths</em>.
*
* <p>To run these tests in an IDE that does not have built-in support for the JUnit
......@@ -48,9 +48,9 @@ import static org.mockito.Mockito.*;
*
* @author Sam Brannen
* @since 5.0
* @see DisabledIfTestCase
* @see DisabledIfTests
*/
class DisabledIfConditionTestCase {
class DisabledIfConditionTests {
private final DisabledIfCondition condition = new DisabledIfCondition();
......
/*
* Copyright 2002-2017 the original author or authors.
* Copyright 2002-2018 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.
......@@ -37,16 +37,16 @@ import static org.junit.jupiter.api.Assertions.fail;
* @author Tadaya Tsuyukubo
* @author Sam Brannen
* @since 5.0
* @see DisabledIfConditionTestCase
* @see DisabledIfConditionTests
* @see DisabledIf
* @see SpringExtension
*/
class DisabledIfTestCase {
class DisabledIfTests {
@SpringJUnitConfig(Config.class)
@TestPropertySource(properties = "foo = true")
@Nested
class DisabledIfOnMethodTestCase {
class DisabledIfOnMethodTests {
@Test
@DisabledIf("true")
......@@ -131,7 +131,7 @@ class DisabledIfTestCase {
@SpringJUnitConfig(Config.class)
@Nested
@DisabledIf("true")
class DisabledIfOnClassTestCase {
class DisabledIfOnClassTests {
@Test
void foo() {
......
/*
* Copyright 2002-2017 the original author or authors.
* Copyright 2002-2018 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.
......@@ -38,16 +38,16 @@ import static org.junit.jupiter.api.Assertions.fail;
* @author Tadaya Tsuyukubo
* @author Sam Brannen
* @since 5.0
* @see EnabledIfConditionTestCase
* @see EnabledIfConditionTests
* @see EnabledIf
* @see SpringExtension
*/
class EnabledIfTestCase {
class EnabledIfTests {
@SpringJUnitConfig(Config.class)
@TestPropertySource(properties = "foo = false")
@Nested
class EnabledIfOnMethodTestCase {
class EnabledIfOnMethodTests {
@Test
@EnabledIf("false")
......@@ -133,7 +133,7 @@ class EnabledIfTestCase {
@SpringJUnitConfig(Config.class)
@Nested
@EnabledIf("false")
class EnabledIfOnClassTestCase {
class EnabledIfOnClassTests {
@Test
void foo() {
......
......@@ -71,20 +71,20 @@ import static org.junit.platform.launcher.core.LauncherDiscoveryRequestBuilder.*
* @author Sam Brannen
* @since 5.0
*/
class FailingBeforeAndAfterMethodsSpringExtensionTestCase {
class FailingBeforeAndAfterMethodsSpringExtensionTests {
private static Stream<Class<?>> testClasses() {
// @formatter:off
return Stream.of(
AlwaysFailingBeforeTestClassTestKase.class,
AlwaysFailingAfterTestClassTestKase.class,
AlwaysFailingPrepareTestInstanceTestKase.class,
AlwaysFailingBeforeTestMethodTestKase.class,
AlwaysFailingBeforeTestExecutionTestKase.class,
AlwaysFailingAfterTestExecutionTestKase.class,
AlwaysFailingAfterTestMethodTestKase.class,
FailingBeforeTransactionTestKase.class,
FailingAfterTransactionTestKase.class);
AlwaysFailingBeforeTestClassTestCase.class,
AlwaysFailingAfterTestClassTestCase.class,
AlwaysFailingPrepareTestInstanceTestCase.class,
AlwaysFailingBeforeTestMethodTestCase.class,
AlwaysFailingBeforeTestExecutionTestCase.class,
AlwaysFailingAfterTestExecutionTestCase.class,
AlwaysFailingAfterTestMethodTestCase.class,
FailingBeforeTransactionTestCase.class,
FailingAfterTransactionTestCase.class);
// @formatter:on
}
......@@ -131,16 +131,16 @@ class FailingBeforeAndAfterMethodsSpringExtensionTestCase {
}
private int getExpectedStartedCount(Class<?> testClass) {
return (testClass == AlwaysFailingBeforeTestClassTestKase.class ? 0 : 1);
return (testClass == AlwaysFailingBeforeTestClassTestCase.class ? 0 : 1);
}
private int getExpectedSucceededCount(Class<?> testClass) {
return (testClass == AlwaysFailingAfterTestClassTestKase.class ? 1 : 0);
return (testClass == AlwaysFailingAfterTestClassTestCase.class ? 1 : 0);
}
private int getExpectedFailedCount(Class<?> testClass) {
if (testClass == AlwaysFailingBeforeTestClassTestKase.class
|| testClass == AlwaysFailingAfterTestClassTestKase.class) {
if (testClass == AlwaysFailingBeforeTestClassTestCase.class
|| testClass == AlwaysFailingAfterTestClassTestCase.class) {
return 0;
}
return 1;
......@@ -205,6 +205,7 @@ class FailingBeforeAndAfterMethodsSpringExtensionTestCase {
}
}
@FailingTestCase
@ExtendWith(SpringExtension.class)
private static abstract class BaseTestCase {
......@@ -214,44 +215,37 @@ class FailingBeforeAndAfterMethodsSpringExtensionTestCase {
}
@TestExecutionListeners(AlwaysFailingBeforeTestClassTestExecutionListener.class)
// TestKase with a "K" so that it's not picked up by the suite or build
static class AlwaysFailingBeforeTestClassTestKase extends BaseTestCase {
static class AlwaysFailingBeforeTestClassTestCase extends BaseTestCase {
}
@TestExecutionListeners(AlwaysFailingAfterTestClassTestExecutionListener.class)
// TestKase with a "K" so that it's not picked up by the suite or build
static class AlwaysFailingAfterTestClassTestKase extends BaseTestCase {
static class AlwaysFailingAfterTestClassTestCase extends BaseTestCase {
}
@TestExecutionListeners(AlwaysFailingPrepareTestInstanceTestExecutionListener.class)
// TestKase with a "K" so that it's not picked up by the suite or build
static class AlwaysFailingPrepareTestInstanceTestKase extends BaseTestCase {
static class AlwaysFailingPrepareTestInstanceTestCase extends BaseTestCase {
}
@TestExecutionListeners(AlwaysFailingBeforeTestMethodTestExecutionListener.class)
// TestKase with a "K" so that it's not picked up by the suite or build
static class AlwaysFailingBeforeTestMethodTestKase extends BaseTestCase {
static class AlwaysFailingBeforeTestMethodTestCase extends BaseTestCase {
}
@TestExecutionListeners(AlwaysFailingBeforeTestExecutionTestExecutionListener.class)
// TestKase with a "K" so that it's not picked up by the suite or build
static class AlwaysFailingBeforeTestExecutionTestKase extends BaseTestCase {
static class AlwaysFailingBeforeTestExecutionTestCase extends BaseTestCase {
}
@TestExecutionListeners(AlwaysFailingAfterTestExecutionTestExecutionListener.class)
// TestKase with a "K" so that it's not picked up by the suite or build
static class AlwaysFailingAfterTestExecutionTestKase extends BaseTestCase {
static class AlwaysFailingAfterTestExecutionTestCase extends BaseTestCase {
}
@TestExecutionListeners(AlwaysFailingAfterTestMethodTestExecutionListener.class)
// TestKase with a "K" so that it's not picked up by the suite or build
static class AlwaysFailingAfterTestMethodTestKase extends BaseTestCase {
static class AlwaysFailingAfterTestMethodTestCase extends BaseTestCase {
}
@FailingTestCase
@SpringJUnitConfig(DatabaseConfig.class)
@Transactional
// TestKase with a "K" so that it's not picked up by the suite or build
static class FailingBeforeTransactionTestKase {
static class FailingBeforeTransactionTestCase {
@Test
void testNothing() {
......@@ -263,10 +257,10 @@ class FailingBeforeAndAfterMethodsSpringExtensionTestCase {
}
}
@FailingTestCase
@SpringJUnitConfig(DatabaseConfig.class)
@Transactional
// TestKase with a "K" so that it's not picked up by the suite or build
static class FailingAfterTransactionTestKase {
static class FailingAfterTransactionTestCase {
@Test
void testNothing() {
......
/*
* Copyright 2002-2018 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.test.context.junit.jupiter;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import org.junit.jupiter.api.Tag;
/**
* Custom annotation for tagging "fake" test cases which are supposed to fail
* but are only intended to be used internally by "real" passing tests.
*
* @author Sam Brannen
* @since 5.1
*/
@Target({ ElementType.TYPE, ElementType.METHOD })
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Tag("failing-test-case")
public @interface FailingTestCase {
}
......@@ -49,13 +49,13 @@ import static org.junit.jupiter.api.Assertions.*;
*
* @author Sam Brannen
* @since 5.1
* @see SpringExtensionTestCase
* @see SpringExtensionTests
* @see SpringExtension
* @see RegisterExtension
*/
@ContextConfiguration(classes = TestConfig.class)
@TestPropertySource(properties = "enigma = 42")
class RegisterExtensionSpringExtensionTestCase {
class RegisterExtensionSpringExtensionTests {
@RegisterExtension
static final SpringExtension springExtension = new SpringExtension();
......
/*
* Copyright 2002-2017 the original author or authors.
* Copyright 2002-2018 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.
......@@ -45,7 +45,7 @@ import static org.junit.jupiter.api.Assertions.*;
* @see ParameterizedTest
*/
@SpringJUnitConfig(TestConfig.class)
class SpringExtensionParameterizedTestCase {
class SpringExtensionParameterizedTests {
@ParameterizedTest
@ValueSource(strings = { "Dilbert", "Wally" })
......
......@@ -48,12 +48,12 @@ import static org.junit.jupiter.api.Assertions.*;
* @author Sam Brannen
* @since 5.0
* @see SpringExtension
* @see ComposedSpringExtensionTestCase
* @see ComposedSpringExtensionTests
*/
@ExtendWith(SpringExtension.class)
@ContextConfiguration(classes = TestConfig.class)
@TestPropertySource(properties = "enigma = 42")
class SpringExtensionTestCase {
class SpringExtensionTests {
@Autowired
Person dilbert;
......
......@@ -38,11 +38,11 @@ import static org.junit.jupiter.api.Assertions.*;
* @author Sam Brannen
* @since 5.0
* @see SpringExtension
* @see SpringJUnitJupiterConstructorInjectionTestCase
* @see SpringJUnitJupiterConstructorInjectionTests
*/
@SpringJUnitConfig(TestConfig.class)
@TestPropertySource(properties = "enigma = 42")
class SpringJUnitJupiterAutowiredConstructorInjectionTestCase {
class SpringJUnitJupiterAutowiredConstructorInjectionTests {
final ApplicationContext applicationContext;
final Person dilbert;
......@@ -50,7 +50,7 @@ class SpringJUnitJupiterAutowiredConstructorInjectionTestCase {
final Integer enigma;
@Autowired
SpringJUnitJupiterAutowiredConstructorInjectionTestCase(ApplicationContext applicationContext, Person dilbert, Dog dog,
SpringJUnitJupiterAutowiredConstructorInjectionTests(ApplicationContext applicationContext, Person dilbert, Dog dog,
@Value("${enigma}") Integer enigma) {
this.applicationContext = applicationContext;
......
......@@ -40,11 +40,11 @@ import static org.junit.jupiter.api.Assertions.*;
* @author Sam Brannen
* @since 5.0
* @see SpringExtension
* @see SpringJUnitJupiterAutowiredConstructorInjectionTestCase
* @see SpringJUnitJupiterAutowiredConstructorInjectionTests
*/
@SpringJUnitConfig(TestConfig.class)
@TestPropertySource(properties = "enigma = 42")
class SpringJUnitJupiterConstructorInjectionTestCase {
class SpringJUnitJupiterConstructorInjectionTests {
final ApplicationContext applicationContext;
final Person dilbert;
......@@ -52,7 +52,7 @@ class SpringJUnitJupiterConstructorInjectionTestCase {
final Integer enigma;
final TestInfo testInfo;
SpringJUnitJupiterConstructorInjectionTestCase(ApplicationContext applicationContext, @Autowired Person dilbert,
SpringJUnitJupiterConstructorInjectionTests(ApplicationContext applicationContext, @Autowired Person dilbert,
@Autowired Dog dog, @Value("${enigma}") Integer enigma, TestInfo testInfo) {
this.applicationContext = applicationContext;
......
/*
* Copyright 2002-2017 the original author or authors.
* Copyright 2002-2018 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.
......@@ -31,7 +31,7 @@ import org.springframework.test.context.junit.jupiter.comics.Cat;
* @author Sam Brannen
* @since 5.0
*/
class CatInterfaceDefaultMethodsTestCase implements GenericComicCharactersInterfaceDefaultMethodsTestCase<Cat> {
class CatInterfaceDefaultMethodsTests implements GenericComicCharactersInterfaceDefaultMethodsTests<Cat> {
@Override
public int getExpectedNumCharacters() {
......
/*
* Copyright 2002-2017 the original author or authors.
* Copyright 2002-2018 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.
......@@ -31,7 +31,7 @@ import org.springframework.test.context.junit.jupiter.comics.Dog;
* @author Sam Brannen
* @since 5.0
*/
class DogInterfaceDefaultMethodsTestCase implements GenericComicCharactersInterfaceDefaultMethodsTestCase<Dog> {
class DogInterfaceDefaultMethodsTests implements GenericComicCharactersInterfaceDefaultMethodsTests<Dog> {
@Override
public int getExpectedNumCharacters() {
......
/*
* Copyright 2002-2017 the original author or authors.
* Copyright 2002-2018 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.
......@@ -41,7 +41,7 @@ import static org.junit.jupiter.api.Assertions.*;
* @since 5.0
*/
@SpringJUnitConfig(TestConfig.class)
interface GenericComicCharactersInterfaceDefaultMethodsTestCase<C extends Character> {
interface GenericComicCharactersInterfaceDefaultMethodsTests<C extends Character> {
@Test
default void autowiredParameterWithParameterizedList(@Autowired List<C> characters) {
......
/*
* Copyright 2002-2017 the original author or authors.
* Copyright 2002-2018 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.
......@@ -31,7 +31,7 @@ import org.springframework.test.context.junit.jupiter.comics.Cat;
* @author Sam Brannen
* @since 5.0
*/
class CatTestCase extends GenericComicCharactersTestCase<Cat> {
class CatTests extends GenericComicCharactersTests<Cat> {
@Override
int getExpectedNumCharacters() {
......
/*
* Copyright 2002-2017 the original author or authors.
* Copyright 2002-2018 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.
......@@ -31,7 +31,7 @@ import org.springframework.test.context.junit.jupiter.comics.Dog;
* @author Sam Brannen
* @since 5.0
*/
class DogTestCase extends GenericComicCharactersTestCase<Dog> {
class DogTests extends GenericComicCharactersTests<Dog> {
@Override
int getExpectedNumCharacters() {
......
......@@ -41,7 +41,7 @@ import static org.junit.jupiter.api.Assertions.*;
* @since 5.0
*/
@SpringJUnitConfig(TestConfig.class)
abstract class GenericComicCharactersTestCase<T extends Character> {
abstract class GenericComicCharactersTests<T extends Character> {
@Autowired
T character;
......
......@@ -35,10 +35,10 @@ import org.springframework.test.context.junit.jupiter.comics.Dog;
* @author Sam Brannen
* @since 5.0.5
*/
class GenericsAndNestedTestsTestCase {
class GenericsAndNestedTests {
@Nested
class CatTestCase extends GenericComicCharactersTestCase<Cat> {
class CatTests extends GenericComicCharactersTests<Cat> {
@Override
int getExpectedNumCharacters() {
......@@ -52,7 +52,7 @@ class GenericsAndNestedTestsTestCase {
}
@Nested
class DogTestCase extends GenericComicCharactersTestCase<Dog> {
class DogTests extends GenericComicCharactersTests<Dog> {
@Override
int getExpectedNumCharacters() {
......
......@@ -28,7 +28,7 @@ import org.springframework.context.annotation.Configuration;
import org.springframework.test.context.junit.SpringJUnitJupiterTestSuite;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
import org.springframework.test.context.junit.jupiter.nested.NestedTestsWithConstructorInjectionWithSpringAndJUnitJupiterTestCase.TopLevelConfig;
import org.springframework.test.context.junit.jupiter.nested.NestedTestsWithConstructorInjectionWithSpringAndJUnitJupiterTests.TopLevelConfig;
import static org.junit.jupiter.api.Assertions.*;
......@@ -43,15 +43,15 @@ import static org.junit.jupiter.api.Assertions.*;
*
* @author Sam Brannen
* @since 5.0.5
* @see NestedTestsWithSpringAndJUnitJupiterTestCase
* @see NestedTestsWithSpringAndJUnitJupiterTests
* @see org.springframework.test.context.junit4.nested.NestedTestsWithSpringRulesTests
*/
@SpringJUnitConfig(TopLevelConfig.class)
class NestedTestsWithConstructorInjectionWithSpringAndJUnitJupiterTestCase {
class NestedTestsWithConstructorInjectionWithSpringAndJUnitJupiterTests {
final String foo;
NestedTestsWithConstructorInjectionWithSpringAndJUnitJupiterTestCase(TestInfo testInfo, @Autowired String foo) {
NestedTestsWithConstructorInjectionWithSpringAndJUnitJupiterTests(TestInfo testInfo, @Autowired String foo) {
this.foo = foo;
}
......@@ -62,12 +62,12 @@ class NestedTestsWithConstructorInjectionWithSpringAndJUnitJupiterTestCase {
@Nested
@SpringJUnitConfig(NestedConfig.class)
class AutowiredConstructor {
class AutowiredConstructorTests {
final String bar;
@Autowired
AutowiredConstructor(String bar) {
AutowiredConstructorTests(String bar) {
this.bar = bar;
}
......@@ -80,11 +80,11 @@ class NestedTestsWithConstructorInjectionWithSpringAndJUnitJupiterTestCase {
@Nested
@SpringJUnitConfig(NestedConfig.class)
class AutowiredConstructorParameter {
class AutowiredConstructorParameterTests {
final String bar;
AutowiredConstructorParameter(@Autowired String bar) {
AutowiredConstructorParameterTests(@Autowired String bar) {
this.bar = bar;
}
......@@ -97,11 +97,11 @@ class NestedTestsWithConstructorInjectionWithSpringAndJUnitJupiterTestCase {
@Nested
@SpringJUnitConfig(NestedConfig.class)
class QualifiedConstructorParameter {
class QualifiedConstructorParameterTests {
final String bar;
QualifiedConstructorParameter(TestInfo testInfo, @Qualifier("bar") String s) {
QualifiedConstructorParameterTests(TestInfo testInfo, @Qualifier("bar") String s) {
this.bar = s;
}
......@@ -114,12 +114,12 @@ class NestedTestsWithConstructorInjectionWithSpringAndJUnitJupiterTestCase {
@Nested
@SpringJUnitConfig(NestedConfig.class)
class SpelConstructorParameter {
class SpelConstructorParameterTests {
final String bar;
final int answer;
SpelConstructorParameter(@Autowired String bar, TestInfo testInfo, @Value("#{ 6 * 7 }") int answer) {
SpelConstructorParameterTests(@Autowired String bar, TestInfo testInfo, @Value("#{ 6 * 7 }") int answer) {
this.bar = bar;
this.answer = answer;
}
......
/*
* Copyright 2002-2017 the original author or authors.
* Copyright 2002-2018 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.
......@@ -25,7 +25,7 @@ import org.springframework.context.annotation.Configuration;
import org.springframework.test.context.junit.SpringJUnitJupiterTestSuite;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
import org.springframework.test.context.junit.jupiter.nested.NestedTestsWithSpringAndJUnitJupiterTestCase.TopLevelConfig;
import org.springframework.test.context.junit.jupiter.nested.NestedTestsWithSpringAndJUnitJupiterTests.TopLevelConfig;
import static org.junit.jupiter.api.Assertions.assertEquals;
......@@ -38,11 +38,11 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
*
* @author Sam Brannen
* @since 5.0
* @see NestedTestsWithConstructorInjectionWithSpringAndJUnitJupiterTestCase
* @see NestedTestsWithConstructorInjectionWithSpringAndJUnitJupiterTests
* @see org.springframework.test.context.junit4.nested.NestedTestsWithSpringRulesTests
*/
@SpringJUnitConfig(TopLevelConfig.class)
class NestedTestsWithSpringAndJUnitJupiterTestCase {
class NestedTestsWithSpringAndJUnitJupiterTests {
@Autowired
String foo;
......@@ -56,7 +56,7 @@ class NestedTestsWithSpringAndJUnitJupiterTestCase {
@Nested
@SpringJUnitConfig(NestedConfig.class)
class NestedTestCase {
class NestedTests {
@Autowired
String bar;
......
/*
* Copyright 2002-2017 the original author or authors.
* Copyright 2002-2018 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.
......@@ -44,10 +44,10 @@ import static org.springframework.test.web.servlet.setup.MockMvcBuilders.*;
* @since 5.0
* @see SpringExtension
* @see SpringJUnitWebConfig
* @see org.springframework.test.context.junit.jupiter.web.WebSpringExtensionTestCase
* @see org.springframework.test.context.junit.jupiter.web.WebSpringExtensionTests
*/
@SpringJUnitWebConfig(WebConfig.class)
class MultipleWebRequestsSpringExtensionTestCase {
class MultipleWebRequestsSpringExtensionTests {
MockMvc mockMvc;
......
/*
* Copyright 2002-2017 the original author or authors.
* Copyright 2002-2018 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.
......@@ -48,13 +48,13 @@ import static org.springframework.test.web.servlet.setup.MockMvcBuilders.*;
* @since 5.0
* @see SpringExtension
* @see SpringJUnitWebConfig
* @see org.springframework.test.context.junit.jupiter.web.MultipleWebRequestsSpringExtensionTestCase
* @see org.springframework.test.context.junit.jupiter.web.MultipleWebRequestsSpringExtensionTests
* @see org.springframework.test.context.junit.jupiter.SpringExtensionTests
* @see org.springframework.test.context.junit.jupiter.ComposedSpringExtensionTests
*/
@SpringJUnitWebConfig(WebConfig.class)
@DisplayName("Web SpringExtension Tests")
class WebSpringExtensionTestCase {
class WebSpringExtensionTests {
@Test
void springMvcTest(WebApplicationContext wac) throws Exception {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册