Skip to content

Commit

Permalink
Migrate to JUnit5
Browse files Browse the repository at this point in the history
  • Loading branch information
amogozov committed Dec 31, 2017
1 parent a20e54d commit 6694d74
Show file tree
Hide file tree
Showing 408 changed files with 2,673 additions and 2,182 deletions.
9 changes: 7 additions & 2 deletions abstract-document/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,13 @@
<artifactId>abstract-document</artifactId>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,16 @@
*/
package com.iluwatar.abstractdocument;

import org.junit.Test;
import org.junit.jupiter.api.Test;

import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Stream;

import static junit.framework.TestCase.assertEquals;
import static junit.framework.TestCase.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;

/**
* AbstractDocument test class
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
*/
package com.iluwatar.abstractdocument;

import org.junit.Test;
import org.junit.jupiter.api.Test;

/**
* Simple App test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@
import com.iluwatar.abstractdocument.domain.HasPrice;
import com.iluwatar.abstractdocument.domain.HasType;
import com.iluwatar.abstractdocument.domain.Part;
import org.junit.Test;
import org.junit.jupiter.api.Test;

import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;

import static junit.framework.TestCase.assertEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;

/**
* Test for Part and Car
Expand Down
9 changes: 7 additions & 2 deletions abstract-factory/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,13 @@
<artifactId>abstract-factory</artifactId>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@
*/
package com.iluwatar.abstractfactory;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;

import com.iluwatar.abstractfactory.App.FactoryMaker;
import com.iluwatar.abstractfactory.App.FactoryMaker.KingdomType;

import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

/**
* Test for abstract factory
Expand All @@ -40,7 +40,7 @@ public class AbstractFactoryTest {
private KingdomFactory elfFactory;
private KingdomFactory orcFactory;

@Before
@BeforeEach
public void setUp() {
elfFactory = FactoryMaker.makeFactory(KingdomType.ELF);
orcFactory = FactoryMaker.makeFactory(KingdomType.ORC);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
*/
package com.iluwatar.abstractfactory;

import org.junit.Test;
import org.junit.jupiter.api.Test;

import java.io.IOException;

Expand Down
9 changes: 7 additions & 2 deletions adapter/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,13 @@
<artifactId>adapter</artifactId>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
*/
package com.iluwatar.adapter;

import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import java.util.HashMap;
import java.util.Map;
Expand All @@ -46,7 +46,7 @@ public class AdapterPatternTest {
/**
* This method runs before the test execution and sets the bean objects in the beans Map.
*/
@Before
@BeforeEach
public void setup() {
beans = new HashMap<>();

Expand Down
2 changes: 1 addition & 1 deletion adapter/src/test/java/com/iluwatar/adapter/AppTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
*/
package com.iluwatar.adapter;

import org.junit.Test;
import org.junit.jupiter.api.Test;

import java.io.IOException;

Expand Down
9 changes: 7 additions & 2 deletions aggregator-microservices/aggregator-service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,13 @@
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@
*/
package com.iluwatar.aggregator.microservices;

import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.when;

import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.mockito.Mockito.when;

/**
* Test Aggregation of domain objects
*/
Expand All @@ -45,7 +45,7 @@ public class AggregatorTest {
@Mock
private ProductInventoryClient inventoryClient;

@Before
@BeforeEach
public void setup() {
MockitoAnnotations.initMocks(this);
}
Expand Down
9 changes: 7 additions & 2 deletions aggregator-microservices/information-microservice/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,13 @@
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@
*/
package com.iluwatar.information.microservice;

import org.junit.Assert;
import org.junit.Test;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertEquals;

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

String title = infoController.getProductTitle();

Assert.assertEquals("The Product Title.", title);
assertEquals("The Product Title.", title);
}

}
9 changes: 7 additions & 2 deletions aggregator-microservices/inventory-microservice/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,13 @@
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@
*/
package com.iluwatar.inventory.microservice;

import org.junit.Assert;
import org.junit.Test;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertEquals;

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

int numberOfInventories = inventoryController.getProductInventories();

Assert.assertEquals(5, numberOfInventories);
assertEquals(5, numberOfInventories);
}
}
9 changes: 7 additions & 2 deletions api-gateway/api-gateway-service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,13 @@
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@
*/
package com.iluwatar.api.gateway;

import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.when;

import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.mockito.Mockito.when;

/**
* Test API Gateway Pattern
*/
Expand All @@ -45,7 +45,7 @@ public class ApiGatewayTest {
@Mock
private PriceClient priceClient;

@Before
@BeforeEach
public void setup() {
MockitoAnnotations.initMocks(this);
}
Expand Down
9 changes: 7 additions & 2 deletions api-gateway/image-microservice/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,13 @@
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@
*/
package com.iluwatar.image.microservice;

import org.junit.Assert;
import org.junit.Test;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertEquals;

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

String imagePath = imageController.getImagePath();

Assert.assertEquals("/product-image.png", imagePath);
assertEquals("/product-image.png", imagePath);
}
}
9 changes: 7 additions & 2 deletions api-gateway/price-microservice/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,13 @@
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
*/
package com.iluwatar.price.microservice;

import org.junit.Assert;
import org.junit.Test;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertEquals;

/**
* Test for Price Rest Controller
Expand All @@ -36,6 +36,6 @@ public void testgetPrice() {

String price = priceController.getPrice();

Assert.assertEquals("20", price);
assertEquals("20", price);
}
}
Loading

0 comments on commit 6694d74

Please sign in to comment.