Switch focus to JUnit Jupiter in testing examples
This commit is contained in:
@@ -356,16 +356,16 @@ import org.springframework.stereotype.Component;
|
||||
* {@code @Component} classes.
|
||||
*
|
||||
* <pre class="code">
|
||||
* @RunWith(SpringRunner.class)
|
||||
* @ExtendWith(SpringExtension.class)
|
||||
* @ContextConfiguration(classes = {AppConfig.class, DatabaseConfig.class})
|
||||
* public class MyTests {
|
||||
* class MyTests {
|
||||
*
|
||||
* @Autowired MyBean myBean;
|
||||
*
|
||||
* @Autowired DataSource dataSource;
|
||||
*
|
||||
* @Test
|
||||
* public void test() {
|
||||
* void test() {
|
||||
* // assertions against myBean ...
|
||||
* }
|
||||
* }</pre>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2020 the original author or authors.
|
||||
* Copyright 2002-2022 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.
|
||||
@@ -42,16 +42,16 @@ import java.lang.annotation.Target;
|
||||
* the one for the child context (i.e., the lowest context in the hierarchy).
|
||||
*
|
||||
* <pre class="code">
|
||||
* @RunWith(SpringRunner.class)
|
||||
* @ExtendWith(SpringExtension.class)
|
||||
* @WebAppConfiguration
|
||||
* @ContextHierarchy({
|
||||
* @ContextConfiguration(classes = TestAppConfig.class),
|
||||
* @ContextConfiguration(classes = WebConfig.class)
|
||||
* })
|
||||
* public class ControllerIntegrationTests {
|
||||
* class ControllerIntegrationTests {
|
||||
*
|
||||
* @Autowired
|
||||
* private WebApplicationContext wac;
|
||||
* WebApplicationContext wac;
|
||||
*
|
||||
* // ...
|
||||
* }</pre>
|
||||
@@ -71,7 +71,7 @@ import java.lang.annotation.Target;
|
||||
* the parent context for each of the contexts loaded for the concrete subclasses.
|
||||
*
|
||||
* <pre class="code">
|
||||
* @RunWith(SpringRunner.class)
|
||||
* @ExtendWith(SpringExtension.class)
|
||||
* @WebAppConfiguration
|
||||
* @ContextConfiguration("file:src/main/webapp/WEB-INF/applicationContext.xml")
|
||||
* public abstract class AbstractWebTests {}
|
||||
@@ -98,7 +98,7 @@ import java.lang.annotation.Target;
|
||||
* "/order-config.xml"}</code>.
|
||||
*
|
||||
* <pre class="code">
|
||||
* @RunWith(SpringRunner.class)
|
||||
* @ExtendWith(SpringExtension.class)
|
||||
* @ContextHierarchy({
|
||||
* @ContextConfiguration(name = "parent", locations = "/app-config.xml"),
|
||||
* @ContextConfiguration(name = "child", locations = "/user-config.xml")
|
||||
@@ -119,7 +119,7 @@ import java.lang.annotation.Target;
|
||||
* context loaded from {@code "/app-config.xml"}.
|
||||
*
|
||||
* <pre class="code">
|
||||
* @RunWith(SpringRunner.class)
|
||||
* @ExtendWith(SpringExtension.class)
|
||||
* @ContextHierarchy({
|
||||
* @ContextConfiguration(name = "parent", locations = "/app-config.xml"),
|
||||
* @ContextConfiguration(name = "child", locations = "/user-config.xml")
|
||||
|
||||
Reference in New Issue
Block a user