[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 org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.ToString;
|
|
||||||
|
|
||||||
@ToString
|
|
||||||
@Component
|
@Component
|
||||||
public class UserCache {
|
public class UserCache {
|
||||||
|
|
||||||
|
@ -1,13 +1,16 @@
|
|||||||
package com.baeldung.dirtiescontext;
|
package com.baeldung.dirtiescontext;
|
||||||
|
|
||||||
|
import org.junit.FixMethodOrder;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
|
import org.junit.runners.MethodSorters;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
import org.springframework.test.annotation.DirtiesContext;
|
import org.springframework.test.annotation.DirtiesContext;
|
||||||
import org.springframework.test.annotation.DirtiesContext.MethodMode;
|
import org.springframework.test.annotation.DirtiesContext.MethodMode;
|
||||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||||
|
|
||||||
|
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
||||||
@RunWith(SpringJUnit4ClassRunner.class)
|
@RunWith(SpringJUnit4ClassRunner.class)
|
||||||
@SpringBootTest(classes = SpringDataRestApplication.class)
|
@SpringBootTest(classes = SpringDataRestApplication.class)
|
||||||
class DirtiesContextIntegrationTest {
|
class DirtiesContextIntegrationTest {
|
||||||
@ -15,27 +18,27 @@ class DirtiesContextIntegrationTest {
|
|||||||
@Autowired
|
@Autowired
|
||||||
protected UserCache userCache;
|
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)
|
@DirtiesContext(methodMode = MethodMode.AFTER_METHOD)
|
||||||
@Test
|
@Test
|
||||||
void testOne() {
|
void testC() {
|
||||||
userCache.addUser("John Doe");
|
userCache.addUser("John Doe");
|
||||||
userCache.printUserList("Test One");
|
userCache.printUserList("Test C");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testTwo() {
|
void testD() {
|
||||||
userCache.printUserList("Test Two");
|
userCache.printUserList("Test D");
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void testThree() {
|
|
||||||
userCache.addUser("Jane Doe");
|
|
||||||
userCache.printUserList("Test Three");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void testFour() {
|
|
||||||
userCache.printUserList("Test Four");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user