Junit4 'assertEquals()' from 'Assert' should be replaced with JUnit5 call to method from 'org.junit.jupiter.api.Assertions'
This commit is contained in:
parent
da30a3efd7
commit
e0bdd5a62d
|
@ -5,12 +5,12 @@ import org.junit.jupiter.api.MethodOrderer;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.junit.jupiter.api.TestMethodOrder;
|
import org.junit.jupiter.api.TestMethodOrder;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
@TestMethodOrder(MethodOrderer.MethodName.class)
|
@TestMethodOrder(MethodOrderer.MethodName.class)
|
||||||
public class AlphanumericOrderUnitTest {
|
public class AlphanumericOrderUnitTest {
|
||||||
|
|
||||||
private static StringBuilder output = new StringBuilder("");
|
private static final StringBuilder output = new StringBuilder("");
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void myATest() {
|
void myATest() {
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package com.baeldung.junit5.order;
|
package com.baeldung.junit5.order;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
|
||||||
|
|
||||||
import org.junit.jupiter.api.AfterAll;
|
import org.junit.jupiter.api.AfterAll;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.junit.jupiter.api.TestMethodOrder;
|
import org.junit.jupiter.api.TestMethodOrder;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
@TestMethodOrder(CustomOrder.class)
|
@TestMethodOrder(CustomOrder.class)
|
||||||
public class CustomOrderUnitTest {
|
public class CustomOrderUnitTest {
|
||||||
|
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
package com.baeldung.junit5.order;
|
package com.baeldung.junit5.order;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
|
||||||
|
|
||||||
import org.junit.jupiter.api.AfterAll;
|
import org.junit.jupiter.api.AfterAll;
|
||||||
import org.junit.jupiter.api.DisplayName;
|
import org.junit.jupiter.api.DisplayName;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
public class DefaultOrderUnitTest {
|
public class DefaultOrderUnitTest {
|
||||||
|
|
||||||
private static StringBuilder output = new StringBuilder("");
|
private static final StringBuilder output = new StringBuilder();
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@DisplayName("Test A")
|
@DisplayName("Test A")
|
||||||
|
@ -30,7 +30,7 @@ public class DefaultOrderUnitTest {
|
||||||
|
|
||||||
@AfterAll
|
@AfterAll
|
||||||
public static void assertOutput() {
|
public static void assertOutput() {
|
||||||
assertEquals(output.toString(), "ABC");
|
assertEquals("ABC", output.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,9 @@
|
||||||
package com.baeldung.junit5.order;
|
package com.baeldung.junit5.order;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import org.junit.jupiter.api.*;
|
||||||
|
|
||||||
import org.junit.jupiter.api.AfterAll;
|
|
||||||
import org.junit.jupiter.api.MethodOrderer.OrderAnnotation;
|
import org.junit.jupiter.api.MethodOrderer.OrderAnnotation;
|
||||||
import org.junit.jupiter.api.Order;
|
|
||||||
import org.junit.jupiter.api.Test;
|
import static org.junit.jupiter.api.Assertions.*;
|
||||||
import org.junit.jupiter.api.TestMethodOrder;
|
|
||||||
|
|
||||||
@TestMethodOrder(OrderAnnotation.class)
|
@TestMethodOrder(OrderAnnotation.class)
|
||||||
public class OrderAnnotationUnitTest {
|
public class OrderAnnotationUnitTest {
|
||||||
|
|
|
@ -1,16 +1,16 @@
|
||||||
package com.baeldung.junit5.order;
|
package com.baeldung.junit5.order;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
|
||||||
|
|
||||||
import org.junit.jupiter.api.AfterAll;
|
import org.junit.jupiter.api.AfterAll;
|
||||||
import org.junit.jupiter.api.MethodOrderer;
|
import org.junit.jupiter.api.MethodOrderer;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.junit.jupiter.api.TestMethodOrder;
|
import org.junit.jupiter.api.TestMethodOrder;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
@TestMethodOrder(MethodOrderer.Random.class)
|
@TestMethodOrder(MethodOrderer.Random.class)
|
||||||
public class RandomOrderUnitTest {
|
public class RandomOrderUnitTest {
|
||||||
|
|
||||||
private static StringBuilder output = new StringBuilder("");
|
private static final StringBuilder output = new StringBuilder();
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void myATest() {
|
void myATest() {
|
||||||
|
@ -29,7 +29,7 @@ public class RandomOrderUnitTest {
|
||||||
|
|
||||||
@AfterAll
|
@AfterAll
|
||||||
public static void assertOutput() {
|
public static void assertOutput() {
|
||||||
assertEquals(output.toString(), "ACB");
|
assertEquals("ACB", output.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue