// For Junit5 conflicting tests are resolved using a ResourceLock
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.parallel.ResourceLock;
import org.junit.jupiter.api.parallel.Resources;
class LegacyServiceTest {
@Test
@ResourceLock("SHARED_CONFIG_FILE") // Use any unique string key
void testFirstConflictingOperation() {
// Modifies shared file/state
}
@Test
@ResourceLock("SHARED_CONFIG_FILE") // Matches the key above
void testSecondConflictingOperation() {
// Reads/Modifies same shared file/state
}
}
// For Junit4 use name ordering
Java
import org.junit.Test;
import org.junit.FixMethodOrder;
import org.junit.runners.MethodSorters;
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class LegacyIntegrationTest {
@Test
public void test01_firstOperation() {
// Executes first alphabetically
}
@Test
public void test02_secondOperation() {
// Executes second alphabetically
}
}
For further actions, you may consider blocking this person and/or reporting abuse
Top comments (0)