[BAEL-2998] - rearranging test order
This commit is contained in:
parent
bb71b1ec07
commit
e25f50fa1b
@ -6,9 +6,7 @@ import java.util.Set;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.ToString;
|
||||
|
||||
@ToString
|
||||
@Component
|
||||
public class UserCache {
|
||||
|
||||
|
@ -1,13 +1,16 @@
|
||||
package com.baeldung.dirtiescontext;
|
||||
|
||||
import org.junit.FixMethodOrder;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.MethodSorters;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.annotation.DirtiesContext;
|
||||
import org.springframework.test.annotation.DirtiesContext.MethodMode;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@SpringBootTest(classes = SpringDataRestApplication.class)
|
||||
class DirtiesContextIntegrationTest {
|
||||
@ -15,27 +18,27 @@ class DirtiesContextIntegrationTest {
|
||||
@Autowired
|
||||
protected UserCache userCache;
|
||||
|
||||
@Test
|
||||
void testA() {
|
||||
userCache.addUser("Jane Doe");
|
||||
userCache.printUserList("Test A");
|
||||
}
|
||||
|
||||
@Test
|
||||
void testB() {
|
||||
userCache.printUserList("Test B");
|
||||
}
|
||||
|
||||
@DirtiesContext(methodMode = MethodMode.AFTER_METHOD)
|
||||
@Test
|
||||
void testOne() {
|
||||
void testC() {
|
||||
userCache.addUser("John Doe");
|
||||
userCache.printUserList("Test One");
|
||||
userCache.printUserList("Test C");
|
||||
}
|
||||
|
||||
@Test
|
||||
void testTwo() {
|
||||
userCache.printUserList("Test Two");
|
||||
}
|
||||
|
||||
@Test
|
||||
void testThree() {
|
||||
userCache.addUser("Jane Doe");
|
||||
userCache.printUserList("Test Three");
|
||||
}
|
||||
|
||||
@Test
|
||||
void testFour() {
|
||||
userCache.printUserList("Test Four");
|
||||
void testD() {
|
||||
userCache.printUserList("Test D");
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user