Skip to content

Commit 6694d74

Browse files
committed
Migrate to JUnit5
1 parent a20e54d commit 6694d74

File tree

408 files changed

+2673
-2182
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

408 files changed

+2673
-2182
lines changed

abstract-document/pom.xml

+7-2
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,13 @@
3434
<artifactId>abstract-document</artifactId>
3535
<dependencies>
3636
<dependency>
37-
<groupId>junit</groupId>
38-
<artifactId>junit</artifactId>
37+
<groupId>org.junit.jupiter</groupId>
38+
<artifactId>junit-jupiter-api</artifactId>
39+
<scope>test</scope>
40+
</dependency>
41+
<dependency>
42+
<groupId>org.junit.jupiter</groupId>
43+
<artifactId>junit-jupiter-engine</artifactId>
3944
<scope>test</scope>
4045
</dependency>
4146
</dependencies>

abstract-document/src/test/java/com/iluwatar/abstractdocument/AbstractDocumentTest.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,16 @@
2222
*/
2323
package com.iluwatar.abstractdocument;
2424

25-
import org.junit.Test;
25+
import org.junit.jupiter.api.Test;
2626

2727
import java.util.Arrays;
2828
import java.util.HashMap;
2929
import java.util.List;
3030
import java.util.Map;
3131
import java.util.stream.Stream;
3232

33-
import static junit.framework.TestCase.assertEquals;
34-
import static junit.framework.TestCase.assertNotNull;
33+
import static org.junit.jupiter.api.Assertions.assertEquals;
34+
import static org.junit.jupiter.api.Assertions.assertNotNull;
3535

3636
/**
3737
* AbstractDocument test class

abstract-document/src/test/java/com/iluwatar/abstractdocument/AppTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
*/
2323
package com.iluwatar.abstractdocument;
2424

25-
import org.junit.Test;
25+
import org.junit.jupiter.api.Test;
2626

2727
/**
2828
* Simple App test

abstract-document/src/test/java/com/iluwatar/abstractdocument/DomainTest.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@
2828
import com.iluwatar.abstractdocument.domain.HasPrice;
2929
import com.iluwatar.abstractdocument.domain.HasType;
3030
import com.iluwatar.abstractdocument.domain.Part;
31-
import org.junit.Test;
31+
import org.junit.jupiter.api.Test;
3232

3333
import java.util.Arrays;
3434
import java.util.HashMap;
3535
import java.util.Map;
3636

37-
import static junit.framework.TestCase.assertEquals;
37+
import static org.junit.jupiter.api.Assertions.assertEquals;
3838

3939
/**
4040
* Test for Part and Car

abstract-factory/pom.xml

+7-2
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,13 @@
3434
<artifactId>abstract-factory</artifactId>
3535
<dependencies>
3636
<dependency>
37-
<groupId>junit</groupId>
38-
<artifactId>junit</artifactId>
37+
<groupId>org.junit.jupiter</groupId>
38+
<artifactId>junit-jupiter-api</artifactId>
39+
<scope>test</scope>
40+
</dependency>
41+
<dependency>
42+
<groupId>org.junit.jupiter</groupId>
43+
<artifactId>junit-jupiter-engine</artifactId>
3944
<scope>test</scope>
4045
</dependency>
4146
</dependencies>

abstract-factory/src/test/java/com/iluwatar/abstractfactory/AbstractFactoryTest.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@
2222
*/
2323
package com.iluwatar.abstractfactory;
2424

25-
import static org.junit.Assert.assertEquals;
26-
import static org.junit.Assert.assertTrue;
25+
import static org.junit.jupiter.api.Assertions.assertEquals;
26+
import static org.junit.jupiter.api.Assertions.assertTrue;
2727

2828
import com.iluwatar.abstractfactory.App.FactoryMaker;
2929
import com.iluwatar.abstractfactory.App.FactoryMaker.KingdomType;
3030

31-
import org.junit.Before;
32-
import org.junit.Test;
31+
import org.junit.jupiter.api.BeforeEach;
32+
import org.junit.jupiter.api.Test;
3333

3434
/**
3535
* Test for abstract factory
@@ -40,7 +40,7 @@ public class AbstractFactoryTest {
4040
private KingdomFactory elfFactory;
4141
private KingdomFactory orcFactory;
4242

43-
@Before
43+
@BeforeEach
4444
public void setUp() {
4545
elfFactory = FactoryMaker.makeFactory(KingdomType.ELF);
4646
orcFactory = FactoryMaker.makeFactory(KingdomType.ORC);

abstract-factory/src/test/java/com/iluwatar/abstractfactory/AppTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
*/
2323
package com.iluwatar.abstractfactory;
2424

25-
import org.junit.Test;
25+
import org.junit.jupiter.api.Test;
2626

2727
import java.io.IOException;
2828

adapter/pom.xml

+7-2
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,13 @@
3434
<artifactId>adapter</artifactId>
3535
<dependencies>
3636
<dependency>
37-
<groupId>junit</groupId>
38-
<artifactId>junit</artifactId>
37+
<groupId>org.junit.jupiter</groupId>
38+
<artifactId>junit-jupiter-api</artifactId>
39+
<scope>test</scope>
40+
</dependency>
41+
<dependency>
42+
<groupId>org.junit.jupiter</groupId>
43+
<artifactId>junit-jupiter-engine</artifactId>
3944
<scope>test</scope>
4045
</dependency>
4146
<dependency>

adapter/src/test/java/com/iluwatar/adapter/AdapterPatternTest.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
*/
2323
package com.iluwatar.adapter;
2424

25-
import org.junit.Before;
26-
import org.junit.Test;
25+
import org.junit.jupiter.api.BeforeEach;
26+
import org.junit.jupiter.api.Test;
2727

2828
import java.util.HashMap;
2929
import java.util.Map;
@@ -46,7 +46,7 @@ public class AdapterPatternTest {
4646
/**
4747
* This method runs before the test execution and sets the bean objects in the beans Map.
4848
*/
49-
@Before
49+
@BeforeEach
5050
public void setup() {
5151
beans = new HashMap<>();
5252

adapter/src/test/java/com/iluwatar/adapter/AppTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
*/
2323
package com.iluwatar.adapter;
2424

25-
import org.junit.Test;
25+
import org.junit.jupiter.api.Test;
2626

2727
import java.io.IOException;
2828

aggregator-microservices/aggregator-service/pom.xml

+7-2
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,13 @@
5454
<artifactId>spring-boot-starter-web</artifactId>
5555
</dependency>
5656
<dependency>
57-
<groupId>junit</groupId>
58-
<artifactId>junit</artifactId>
57+
<groupId>org.junit.jupiter</groupId>
58+
<artifactId>junit-jupiter-api</artifactId>
59+
<scope>test</scope>
60+
</dependency>
61+
<dependency>
62+
<groupId>org.junit.jupiter</groupId>
63+
<artifactId>junit-jupiter-engine</artifactId>
5964
<scope>test</scope>
6065
</dependency>
6166
<dependency>

aggregator-microservices/aggregator-service/src/test/java/com/iluwatar/aggregator/microservices/AggregatorTest.java

+6-6
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@
2222
*/
2323
package com.iluwatar.aggregator.microservices;
2424

25-
import static org.junit.Assert.assertEquals;
26-
import static org.mockito.Mockito.when;
27-
28-
import org.junit.Before;
29-
import org.junit.Test;
25+
import org.junit.jupiter.api.BeforeEach;
26+
import org.junit.jupiter.api.Test;
3027
import org.mockito.InjectMocks;
3128
import org.mockito.Mock;
3229
import org.mockito.MockitoAnnotations;
3330

31+
import static org.junit.jupiter.api.Assertions.assertEquals;
32+
import static org.mockito.Mockito.when;
33+
3434
/**
3535
* Test Aggregation of domain objects
3636
*/
@@ -45,7 +45,7 @@ public class AggregatorTest {
4545
@Mock
4646
private ProductInventoryClient inventoryClient;
4747

48-
@Before
48+
@BeforeEach
4949
public void setup() {
5050
MockitoAnnotations.initMocks(this);
5151
}

aggregator-microservices/information-microservice/pom.xml

+7-2
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,13 @@
5454
<artifactId>spring-boot-starter-web</artifactId>
5555
</dependency>
5656
<dependency>
57-
<groupId>junit</groupId>
58-
<artifactId>junit</artifactId>
57+
<groupId>org.junit.jupiter</groupId>
58+
<artifactId>junit-jupiter-api</artifactId>
59+
<scope>test</scope>
60+
</dependency>
61+
<dependency>
62+
<groupId>org.junit.jupiter</groupId>
63+
<artifactId>junit-jupiter-engine</artifactId>
5964
<scope>test</scope>
6065
</dependency>
6166
</dependencies>

aggregator-microservices/information-microservice/src/test/java/com/iluwatar/information/microservice/InformationControllerTest.java

+4-3
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,9 @@
2222
*/
2323
package com.iluwatar.information.microservice;
2424

25-
import org.junit.Assert;
26-
import org.junit.Test;
25+
import org.junit.jupiter.api.Test;
26+
27+
import static org.junit.jupiter.api.Assertions.assertEquals;
2728

2829
/**
2930
* Test for Information Rest Controller
@@ -36,7 +37,7 @@ public void shouldGetProductTitle() {
3637

3738
String title = infoController.getProductTitle();
3839

39-
Assert.assertEquals("The Product Title.", title);
40+
assertEquals("The Product Title.", title);
4041
}
4142

4243
}

aggregator-microservices/inventory-microservice/pom.xml

+7-2
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,13 @@
5454
<artifactId>spring-boot-starter-web</artifactId>
5555
</dependency>
5656
<dependency>
57-
<groupId>junit</groupId>
58-
<artifactId>junit</artifactId>
57+
<groupId>org.junit.jupiter</groupId>
58+
<artifactId>junit-jupiter-api</artifactId>
59+
<scope>test</scope>
60+
</dependency>
61+
<dependency>
62+
<groupId>org.junit.jupiter</groupId>
63+
<artifactId>junit-jupiter-engine</artifactId>
5964
<scope>test</scope>
6065
</dependency>
6166
</dependencies>

aggregator-microservices/inventory-microservice/src/test/java/com/iluwatar/inventory/microservice/InventoryControllerTest.java

+4-3
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,9 @@
2222
*/
2323
package com.iluwatar.inventory.microservice;
2424

25-
import org.junit.Assert;
26-
import org.junit.Test;
25+
import org.junit.jupiter.api.Test;
26+
27+
import static org.junit.jupiter.api.Assertions.assertEquals;
2728

2829
/**
2930
* Test Inventory Rest Controller
@@ -35,6 +36,6 @@ public void testGetProductInventories() throws Exception {
3536

3637
int numberOfInventories = inventoryController.getProductInventories();
3738

38-
Assert.assertEquals(5, numberOfInventories);
39+
assertEquals(5, numberOfInventories);
3940
}
4041
}

api-gateway/api-gateway-service/pom.xml

+7-2
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,13 @@
5353
<artifactId>spring-boot-starter-web</artifactId>
5454
</dependency>
5555
<dependency>
56-
<groupId>junit</groupId>
57-
<artifactId>junit</artifactId>
56+
<groupId>org.junit.jupiter</groupId>
57+
<artifactId>junit-jupiter-api</artifactId>
58+
<scope>test</scope>
59+
</dependency>
60+
<dependency>
61+
<groupId>org.junit.jupiter</groupId>
62+
<artifactId>junit-jupiter-engine</artifactId>
5863
<scope>test</scope>
5964
</dependency>
6065
<dependency>

api-gateway/api-gateway-service/src/test/java/com/iluwatar/api/gateway/ApiGatewayTest.java

+6-6
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@
2222
*/
2323
package com.iluwatar.api.gateway;
2424

25-
import static org.junit.Assert.assertEquals;
26-
import static org.mockito.Mockito.when;
27-
28-
import org.junit.Before;
29-
import org.junit.Test;
25+
import org.junit.jupiter.api.BeforeEach;
26+
import org.junit.jupiter.api.Test;
3027
import org.mockito.InjectMocks;
3128
import org.mockito.Mock;
3229
import org.mockito.MockitoAnnotations;
3330

31+
import static org.junit.jupiter.api.Assertions.assertEquals;
32+
import static org.mockito.Mockito.when;
33+
3434
/**
3535
* Test API Gateway Pattern
3636
*/
@@ -45,7 +45,7 @@ public class ApiGatewayTest {
4545
@Mock
4646
private PriceClient priceClient;
4747

48-
@Before
48+
@BeforeEach
4949
public void setup() {
5050
MockitoAnnotations.initMocks(this);
5151
}

api-gateway/image-microservice/pom.xml

+7-2
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,13 @@
5454
<artifactId>spring-boot-starter-web</artifactId>
5555
</dependency>
5656
<dependency>
57-
<groupId>junit</groupId>
58-
<artifactId>junit</artifactId>
57+
<groupId>org.junit.jupiter</groupId>
58+
<artifactId>junit-jupiter-api</artifactId>
59+
<scope>test</scope>
60+
</dependency>
61+
<dependency>
62+
<groupId>org.junit.jupiter</groupId>
63+
<artifactId>junit-jupiter-engine</artifactId>
5964
<scope>test</scope>
6065
</dependency>
6166
</dependencies>

api-gateway/image-microservice/src/test/java/com/iluwatar/image/microservice/ImageControllerTest.java

+4-3
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,9 @@
2222
*/
2323
package com.iluwatar.image.microservice;
2424

25-
import org.junit.Assert;
26-
import org.junit.Test;
25+
import org.junit.jupiter.api.Test;
26+
27+
import static org.junit.jupiter.api.Assertions.assertEquals;
2728

2829
/**
2930
* Test for Image Rest Controller
@@ -35,6 +36,6 @@ public void testGetImagePath() {
3536

3637
String imagePath = imageController.getImagePath();
3738

38-
Assert.assertEquals("/product-image.png", imagePath);
39+
assertEquals("/product-image.png", imagePath);
3940
}
4041
}

api-gateway/price-microservice/pom.xml

+7-2
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,13 @@
5454
<artifactId>spring-boot-starter-web</artifactId>
5555
</dependency>
5656
<dependency>
57-
<groupId>junit</groupId>
58-
<artifactId>junit</artifactId>
57+
<groupId>org.junit.jupiter</groupId>
58+
<artifactId>junit-jupiter-api</artifactId>
59+
<scope>test</scope>
60+
</dependency>
61+
<dependency>
62+
<groupId>org.junit.jupiter</groupId>
63+
<artifactId>junit-jupiter-engine</artifactId>
5964
<scope>test</scope>
6065
</dependency>
6166
</dependencies>

api-gateway/price-microservice/src/test/java/com/iluwatar/price/microservice/PriceControllerTest.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@
2222
*/
2323
package com.iluwatar.price.microservice;
2424

25-
import org.junit.Assert;
26-
import org.junit.Test;
25+
import org.junit.jupiter.api.Test;
2726

27+
import static org.junit.jupiter.api.Assertions.assertEquals;
2828

2929
/**
3030
* Test for Price Rest Controller
@@ -36,6 +36,6 @@ public void testgetPrice() {
3636

3737
String price = priceController.getPrice();
3838

39-
Assert.assertEquals("20", price);
39+
assertEquals("20", price);
4040
}
4141
}

0 commit comments

Comments
 (0)