Migrate to JUnit5
This commit is contained in:
parent
a20e54d0a7
commit
6694d742a3
@ -34,8 +34,13 @@
|
|||||||
<artifactId>abstract-document</artifactId>
|
<artifactId>abstract-document</artifactId>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>org.junit.jupiter</groupId>
|
||||||
<artifactId>junit</artifactId>
|
<artifactId>junit-jupiter-api</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.junit.jupiter</groupId>
|
||||||
|
<artifactId>junit-jupiter-engine</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
*/
|
*/
|
||||||
package com.iluwatar.abstractdocument;
|
package com.iluwatar.abstractdocument;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@ -30,8 +30,8 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
import static junit.framework.TestCase.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import static junit.framework.TestCase.assertNotNull;
|
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AbstractDocument test class
|
* AbstractDocument test class
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
*/
|
*/
|
||||||
package com.iluwatar.abstractdocument;
|
package com.iluwatar.abstractdocument;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Simple App test
|
* Simple App test
|
||||||
|
@ -28,13 +28,13 @@ import com.iluwatar.abstractdocument.domain.HasParts;
|
|||||||
import com.iluwatar.abstractdocument.domain.HasPrice;
|
import com.iluwatar.abstractdocument.domain.HasPrice;
|
||||||
import com.iluwatar.abstractdocument.domain.HasType;
|
import com.iluwatar.abstractdocument.domain.HasType;
|
||||||
import com.iluwatar.abstractdocument.domain.Part;
|
import com.iluwatar.abstractdocument.domain.Part;
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import static junit.framework.TestCase.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test for Part and Car
|
* Test for Part and Car
|
||||||
|
@ -34,8 +34,13 @@
|
|||||||
<artifactId>abstract-factory</artifactId>
|
<artifactId>abstract-factory</artifactId>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>org.junit.jupiter</groupId>
|
||||||
<artifactId>junit</artifactId>
|
<artifactId>junit-jupiter-api</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.junit.jupiter</groupId>
|
||||||
|
<artifactId>junit-jupiter-engine</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
@ -22,14 +22,14 @@
|
|||||||
*/
|
*/
|
||||||
package com.iluwatar.abstractfactory;
|
package com.iluwatar.abstractfactory;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
|
|
||||||
import com.iluwatar.abstractfactory.App.FactoryMaker;
|
import com.iluwatar.abstractfactory.App.FactoryMaker;
|
||||||
import com.iluwatar.abstractfactory.App.FactoryMaker.KingdomType;
|
import com.iluwatar.abstractfactory.App.FactoryMaker.KingdomType;
|
||||||
|
|
||||||
import org.junit.Before;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test for abstract factory
|
* Test for abstract factory
|
||||||
@ -40,7 +40,7 @@ public class AbstractFactoryTest {
|
|||||||
private KingdomFactory elfFactory;
|
private KingdomFactory elfFactory;
|
||||||
private KingdomFactory orcFactory;
|
private KingdomFactory orcFactory;
|
||||||
|
|
||||||
@Before
|
@BeforeEach
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
elfFactory = FactoryMaker.makeFactory(KingdomType.ELF);
|
elfFactory = FactoryMaker.makeFactory(KingdomType.ELF);
|
||||||
orcFactory = FactoryMaker.makeFactory(KingdomType.ORC);
|
orcFactory = FactoryMaker.makeFactory(KingdomType.ORC);
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
*/
|
*/
|
||||||
package com.iluwatar.abstractfactory;
|
package com.iluwatar.abstractfactory;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
|
@ -34,8 +34,13 @@
|
|||||||
<artifactId>adapter</artifactId>
|
<artifactId>adapter</artifactId>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>org.junit.jupiter</groupId>
|
||||||
<artifactId>junit</artifactId>
|
<artifactId>junit-jupiter-api</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.junit.jupiter</groupId>
|
||||||
|
<artifactId>junit-jupiter-engine</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -22,8 +22,8 @@
|
|||||||
*/
|
*/
|
||||||
package com.iluwatar.adapter;
|
package com.iluwatar.adapter;
|
||||||
|
|
||||||
import org.junit.Before;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -46,7 +46,7 @@ public class AdapterPatternTest {
|
|||||||
/**
|
/**
|
||||||
* This method runs before the test execution and sets the bean objects in the beans Map.
|
* This method runs before the test execution and sets the bean objects in the beans Map.
|
||||||
*/
|
*/
|
||||||
@Before
|
@BeforeEach
|
||||||
public void setup() {
|
public void setup() {
|
||||||
beans = new HashMap<>();
|
beans = new HashMap<>();
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
*/
|
*/
|
||||||
package com.iluwatar.adapter;
|
package com.iluwatar.adapter;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
|
@ -54,8 +54,13 @@
|
|||||||
<artifactId>spring-boot-starter-web</artifactId>
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>org.junit.jupiter</groupId>
|
||||||
<artifactId>junit</artifactId>
|
<artifactId>junit-jupiter-api</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.junit.jupiter</groupId>
|
||||||
|
<artifactId>junit-jupiter-engine</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -22,15 +22,15 @@
|
|||||||
*/
|
*/
|
||||||
package com.iluwatar.aggregator.microservices;
|
package com.iluwatar.aggregator.microservices;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import static org.mockito.Mockito.when;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import org.junit.Before;
|
|
||||||
import org.junit.Test;
|
|
||||||
import org.mockito.InjectMocks;
|
import org.mockito.InjectMocks;
|
||||||
import org.mockito.Mock;
|
import org.mockito.Mock;
|
||||||
import org.mockito.MockitoAnnotations;
|
import org.mockito.MockitoAnnotations;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
import static org.mockito.Mockito.when;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test Aggregation of domain objects
|
* Test Aggregation of domain objects
|
||||||
*/
|
*/
|
||||||
@ -45,7 +45,7 @@ public class AggregatorTest {
|
|||||||
@Mock
|
@Mock
|
||||||
private ProductInventoryClient inventoryClient;
|
private ProductInventoryClient inventoryClient;
|
||||||
|
|
||||||
@Before
|
@BeforeEach
|
||||||
public void setup() {
|
public void setup() {
|
||||||
MockitoAnnotations.initMocks(this);
|
MockitoAnnotations.initMocks(this);
|
||||||
}
|
}
|
||||||
|
@ -54,8 +54,13 @@
|
|||||||
<artifactId>spring-boot-starter-web</artifactId>
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>org.junit.jupiter</groupId>
|
||||||
<artifactId>junit</artifactId>
|
<artifactId>junit-jupiter-api</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.junit.jupiter</groupId>
|
||||||
|
<artifactId>junit-jupiter-engine</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
@ -22,8 +22,9 @@
|
|||||||
*/
|
*/
|
||||||
package com.iluwatar.information.microservice;
|
package com.iluwatar.information.microservice;
|
||||||
|
|
||||||
import org.junit.Assert;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.junit.Test;
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test for Information Rest Controller
|
* Test for Information Rest Controller
|
||||||
@ -36,7 +37,7 @@ public class InformationControllerTest {
|
|||||||
|
|
||||||
String title = infoController.getProductTitle();
|
String title = infoController.getProductTitle();
|
||||||
|
|
||||||
Assert.assertEquals("The Product Title.", title);
|
assertEquals("The Product Title.", title);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -54,8 +54,13 @@
|
|||||||
<artifactId>spring-boot-starter-web</artifactId>
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>org.junit.jupiter</groupId>
|
||||||
<artifactId>junit</artifactId>
|
<artifactId>junit-jupiter-api</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.junit.jupiter</groupId>
|
||||||
|
<artifactId>junit-jupiter-engine</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
@ -22,8 +22,9 @@
|
|||||||
*/
|
*/
|
||||||
package com.iluwatar.inventory.microservice;
|
package com.iluwatar.inventory.microservice;
|
||||||
|
|
||||||
import org.junit.Assert;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.junit.Test;
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test Inventory Rest Controller
|
* Test Inventory Rest Controller
|
||||||
@ -35,6 +36,6 @@ public class InventoryControllerTest {
|
|||||||
|
|
||||||
int numberOfInventories = inventoryController.getProductInventories();
|
int numberOfInventories = inventoryController.getProductInventories();
|
||||||
|
|
||||||
Assert.assertEquals(5, numberOfInventories);
|
assertEquals(5, numberOfInventories);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -53,8 +53,13 @@
|
|||||||
<artifactId>spring-boot-starter-web</artifactId>
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>org.junit.jupiter</groupId>
|
||||||
<artifactId>junit</artifactId>
|
<artifactId>junit-jupiter-api</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.junit.jupiter</groupId>
|
||||||
|
<artifactId>junit-jupiter-engine</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -22,15 +22,15 @@
|
|||||||
*/
|
*/
|
||||||
package com.iluwatar.api.gateway;
|
package com.iluwatar.api.gateway;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import static org.mockito.Mockito.when;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import org.junit.Before;
|
|
||||||
import org.junit.Test;
|
|
||||||
import org.mockito.InjectMocks;
|
import org.mockito.InjectMocks;
|
||||||
import org.mockito.Mock;
|
import org.mockito.Mock;
|
||||||
import org.mockito.MockitoAnnotations;
|
import org.mockito.MockitoAnnotations;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
import static org.mockito.Mockito.when;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test API Gateway Pattern
|
* Test API Gateway Pattern
|
||||||
*/
|
*/
|
||||||
@ -45,7 +45,7 @@ public class ApiGatewayTest {
|
|||||||
@Mock
|
@Mock
|
||||||
private PriceClient priceClient;
|
private PriceClient priceClient;
|
||||||
|
|
||||||
@Before
|
@BeforeEach
|
||||||
public void setup() {
|
public void setup() {
|
||||||
MockitoAnnotations.initMocks(this);
|
MockitoAnnotations.initMocks(this);
|
||||||
}
|
}
|
||||||
|
@ -54,8 +54,13 @@
|
|||||||
<artifactId>spring-boot-starter-web</artifactId>
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>org.junit.jupiter</groupId>
|
||||||
<artifactId>junit</artifactId>
|
<artifactId>junit-jupiter-api</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.junit.jupiter</groupId>
|
||||||
|
<artifactId>junit-jupiter-engine</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
@ -22,8 +22,9 @@
|
|||||||
*/
|
*/
|
||||||
package com.iluwatar.image.microservice;
|
package com.iluwatar.image.microservice;
|
||||||
|
|
||||||
import org.junit.Assert;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.junit.Test;
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test for Image Rest Controller
|
* Test for Image Rest Controller
|
||||||
@ -35,6 +36,6 @@ public class ImageControllerTest {
|
|||||||
|
|
||||||
String imagePath = imageController.getImagePath();
|
String imagePath = imageController.getImagePath();
|
||||||
|
|
||||||
Assert.assertEquals("/product-image.png", imagePath);
|
assertEquals("/product-image.png", imagePath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -54,8 +54,13 @@
|
|||||||
<artifactId>spring-boot-starter-web</artifactId>
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>org.junit.jupiter</groupId>
|
||||||
<artifactId>junit</artifactId>
|
<artifactId>junit-jupiter-api</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.junit.jupiter</groupId>
|
||||||
|
<artifactId>junit-jupiter-engine</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
@ -22,9 +22,9 @@
|
|||||||
*/
|
*/
|
||||||
package com.iluwatar.price.microservice;
|
package com.iluwatar.price.microservice;
|
||||||
|
|
||||||
import org.junit.Assert;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test for Price Rest Controller
|
* Test for Price Rest Controller
|
||||||
@ -36,6 +36,6 @@ public class PriceControllerTest {
|
|||||||
|
|
||||||
String price = priceController.getPrice();
|
String price = priceController.getPrice();
|
||||||
|
|
||||||
Assert.assertEquals("20", price);
|
assertEquals("20", price);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -34,8 +34,13 @@
|
|||||||
<artifactId>async-method-invocation</artifactId>
|
<artifactId>async-method-invocation</artifactId>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>org.junit.jupiter</groupId>
|
||||||
<artifactId>junit</artifactId>
|
<artifactId>junit-jupiter-api</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.junit.jupiter</groupId>
|
||||||
|
<artifactId>junit-jupiter-engine</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
*/
|
*/
|
||||||
package com.iluwatar.async.method.invocation;
|
package com.iluwatar.async.method.invocation;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
*/
|
*/
|
||||||
package com.iluwatar.async.method.invocation;
|
package com.iluwatar.async.method.invocation;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.mockito.ArgumentCaptor;
|
import org.mockito.ArgumentCaptor;
|
||||||
import org.mockito.Matchers;
|
import org.mockito.Matchers;
|
||||||
|
|
||||||
@ -30,8 +30,21 @@ import java.util.Optional;
|
|||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
import java.util.concurrent.ExecutionException;
|
import java.util.concurrent.ExecutionException;
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
import static java.time.Duration.ofMillis;
|
||||||
import static org.mockito.Mockito.*;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertSame;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertTimeout;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
|
import static org.junit.jupiter.api.Assertions.fail;
|
||||||
|
import static org.mockito.Matchers.eq;
|
||||||
|
import static org.mockito.Mockito.mock;
|
||||||
|
import static org.mockito.Mockito.timeout;
|
||||||
|
import static org.mockito.Mockito.verify;
|
||||||
|
import static org.mockito.Mockito.verifyNoMoreInteractions;
|
||||||
|
import static org.mockito.Mockito.verifyZeroInteractions;
|
||||||
|
import static org.mockito.Mockito.when;
|
||||||
import static org.mockito.internal.verification.VerificationModeFactory.times;
|
import static org.mockito.internal.verification.VerificationModeFactory.times;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -44,205 +57,217 @@ public class ThreadAsyncExecutorTest {
|
|||||||
/**
|
/**
|
||||||
* Test used to verify the happy path of {@link ThreadAsyncExecutor#startProcess(Callable)}
|
* Test used to verify the happy path of {@link ThreadAsyncExecutor#startProcess(Callable)}
|
||||||
*/
|
*/
|
||||||
@Test(timeout = 3000)
|
@Test
|
||||||
public void testSuccessfulTaskWithoutCallback() throws Exception {
|
public void testSuccessfulTaskWithoutCallback() throws Exception {
|
||||||
// Instantiate a new executor and start a new 'null' task ...
|
assertTimeout(ofMillis(3000), () -> {
|
||||||
final ThreadAsyncExecutor executor = new ThreadAsyncExecutor();
|
// Instantiate a new executor and start a new 'null' task ...
|
||||||
|
final ThreadAsyncExecutor executor = new ThreadAsyncExecutor();
|
||||||
|
|
||||||
final Object result = new Object();
|
final Object result = new Object();
|
||||||
final Callable<Object> task = mock(Callable.class);
|
final Callable<Object> task = mock(Callable.class);
|
||||||
when(task.call()).thenReturn(result);
|
when(task.call()).thenReturn(result);
|
||||||
|
|
||||||
final AsyncResult<Object> asyncResult = executor.startProcess(task);
|
final AsyncResult<Object> asyncResult = executor.startProcess(task);
|
||||||
assertNotNull(asyncResult);
|
assertNotNull(asyncResult);
|
||||||
asyncResult.await(); // Prevent timing issues, and wait until the result is available
|
asyncResult.await(); // Prevent timing issues, and wait until the result is available
|
||||||
assertTrue(asyncResult.isCompleted());
|
assertTrue(asyncResult.isCompleted());
|
||||||
|
|
||||||
// Our task should only execute once ...
|
// Our task should only execute once ...
|
||||||
verify(task, times(1)).call();
|
verify(task, times(1)).call();
|
||||||
|
|
||||||
// ... and the result should be exactly the same object
|
// ... and the result should be exactly the same object
|
||||||
assertSame(result, asyncResult.getValue());
|
assertSame(result, asyncResult.getValue());
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test used to verify the happy path of {@link ThreadAsyncExecutor#startProcess(Callable, AsyncCallback)}
|
* Test used to verify the happy path of {@link ThreadAsyncExecutor#startProcess(Callable, AsyncCallback)}
|
||||||
*/
|
*/
|
||||||
@Test(timeout = 3000)
|
@Test
|
||||||
public void testSuccessfulTaskWithCallback() throws Exception {
|
public void testSuccessfulTaskWithCallback() throws Exception {
|
||||||
// Instantiate a new executor and start a new 'null' task ...
|
assertTimeout(ofMillis(3000), () -> {
|
||||||
final ThreadAsyncExecutor executor = new ThreadAsyncExecutor();
|
// Instantiate a new executor and start a new 'null' task ...
|
||||||
|
final ThreadAsyncExecutor executor = new ThreadAsyncExecutor();
|
||||||
|
|
||||||
final Object result = new Object();
|
final Object result = new Object();
|
||||||
final Callable<Object> task = mock(Callable.class);
|
final Callable<Object> task = mock(Callable.class);
|
||||||
when(task.call()).thenReturn(result);
|
when(task.call()).thenReturn(result);
|
||||||
|
|
||||||
final AsyncCallback callback = mock(AsyncCallback.class);
|
final AsyncCallback callback = mock(AsyncCallback.class);
|
||||||
final AsyncResult<Object> asyncResult = executor.startProcess(task, callback);
|
final AsyncResult<Object> asyncResult = executor.startProcess(task, callback);
|
||||||
assertNotNull(asyncResult);
|
assertNotNull(asyncResult);
|
||||||
asyncResult.await(); // Prevent timing issues, and wait until the result is available
|
asyncResult.await(); // Prevent timing issues, and wait until the result is available
|
||||||
assertTrue(asyncResult.isCompleted());
|
assertTrue(asyncResult.isCompleted());
|
||||||
|
|
||||||
// Our task should only execute once ...
|
// Our task should only execute once ...
|
||||||
verify(task, times(1)).call();
|
verify(task, times(1)).call();
|
||||||
|
|
||||||
// ... same for the callback, we expect our object
|
// ... same for the callback, we expect our object
|
||||||
final ArgumentCaptor<Optional<Exception>> optionalCaptor = ArgumentCaptor.forClass((Class) Optional.class);
|
final ArgumentCaptor<Optional<Exception>> optionalCaptor = ArgumentCaptor.forClass((Class) Optional.class);
|
||||||
verify(callback, times(1)).onComplete(eq(result), optionalCaptor.capture());
|
verify(callback, times(1)).onComplete(eq(result), optionalCaptor.capture());
|
||||||
|
|
||||||
final Optional<Exception> optionalException = optionalCaptor.getValue();
|
final Optional<Exception> optionalException = optionalCaptor.getValue();
|
||||||
assertNotNull(optionalException);
|
assertNotNull(optionalException);
|
||||||
assertFalse(optionalException.isPresent());
|
assertFalse(optionalException.isPresent());
|
||||||
|
|
||||||
// ... and the result should be exactly the same object
|
// ... and the result should be exactly the same object
|
||||||
assertSame(result, asyncResult.getValue());
|
assertSame(result, asyncResult.getValue());
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test used to verify the happy path of {@link ThreadAsyncExecutor#startProcess(Callable)} when a task takes a while
|
* Test used to verify the happy path of {@link ThreadAsyncExecutor#startProcess(Callable)} when a task takes a while
|
||||||
* to execute
|
* to execute
|
||||||
*/
|
*/
|
||||||
@Test(timeout = 5000)
|
@Test
|
||||||
public void testLongRunningTaskWithoutCallback() throws Exception {
|
public void testLongRunningTaskWithoutCallback() throws Exception {
|
||||||
// Instantiate a new executor and start a new 'null' task ...
|
assertTimeout(ofMillis(5000), () -> {
|
||||||
final ThreadAsyncExecutor executor = new ThreadAsyncExecutor();
|
// Instantiate a new executor and start a new 'null' task ...
|
||||||
|
final ThreadAsyncExecutor executor = new ThreadAsyncExecutor();
|
||||||
|
|
||||||
final Object result = new Object();
|
final Object result = new Object();
|
||||||
final Callable<Object> task = mock(Callable.class);
|
final Callable<Object> task = mock(Callable.class);
|
||||||
when(task.call()).thenAnswer(i -> {
|
when(task.call()).thenAnswer(i -> {
|
||||||
Thread.sleep(1500);
|
Thread.sleep(1500);
|
||||||
return result;
|
return result;
|
||||||
|
});
|
||||||
|
|
||||||
|
final AsyncResult<Object> asyncResult = executor.startProcess(task);
|
||||||
|
assertNotNull(asyncResult);
|
||||||
|
assertFalse(asyncResult.isCompleted());
|
||||||
|
|
||||||
|
try {
|
||||||
|
asyncResult.getValue();
|
||||||
|
fail("Expected IllegalStateException when calling AsyncResult#getValue on a non-completed task");
|
||||||
|
} catch (IllegalStateException e) {
|
||||||
|
assertNotNull(e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Our task should only execute once, but it can take a while ...
|
||||||
|
verify(task, timeout(3000).times(1)).call();
|
||||||
|
|
||||||
|
// Prevent timing issues, and wait until the result is available
|
||||||
|
asyncResult.await();
|
||||||
|
assertTrue(asyncResult.isCompleted());
|
||||||
|
verifyNoMoreInteractions(task);
|
||||||
|
|
||||||
|
// ... and the result should be exactly the same object
|
||||||
|
assertSame(result, asyncResult.getValue());
|
||||||
});
|
});
|
||||||
|
|
||||||
final AsyncResult<Object> asyncResult = executor.startProcess(task);
|
|
||||||
assertNotNull(asyncResult);
|
|
||||||
assertFalse(asyncResult.isCompleted());
|
|
||||||
|
|
||||||
try {
|
|
||||||
asyncResult.getValue();
|
|
||||||
fail("Expected IllegalStateException when calling AsyncResult#getValue on a non-completed task");
|
|
||||||
} catch (IllegalStateException e) {
|
|
||||||
assertNotNull(e.getMessage());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Our task should only execute once, but it can take a while ...
|
|
||||||
verify(task, timeout(3000).times(1)).call();
|
|
||||||
|
|
||||||
// Prevent timing issues, and wait until the result is available
|
|
||||||
asyncResult.await();
|
|
||||||
assertTrue(asyncResult.isCompleted());
|
|
||||||
verifyNoMoreInteractions(task);
|
|
||||||
|
|
||||||
// ... and the result should be exactly the same object
|
|
||||||
assertSame(result, asyncResult.getValue());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test used to verify the happy path of {@link ThreadAsyncExecutor#startProcess(Callable, AsyncCallback)} when a task
|
* Test used to verify the happy path of {@link ThreadAsyncExecutor#startProcess(Callable, AsyncCallback)} when a task
|
||||||
* takes a while to execute
|
* takes a while to execute
|
||||||
*/
|
*/
|
||||||
@Test(timeout = 5000)
|
@Test
|
||||||
public void testLongRunningTaskWithCallback() throws Exception {
|
public void testLongRunningTaskWithCallback() throws Exception {
|
||||||
// Instantiate a new executor and start a new 'null' task ...
|
assertTimeout(ofMillis(5000), () -> {
|
||||||
final ThreadAsyncExecutor executor = new ThreadAsyncExecutor();
|
// Instantiate a new executor and start a new 'null' task ...
|
||||||
|
final ThreadAsyncExecutor executor = new ThreadAsyncExecutor();
|
||||||
|
|
||||||
final Object result = new Object();
|
final Object result = new Object();
|
||||||
final Callable<Object> task = mock(Callable.class);
|
final Callable<Object> task = mock(Callable.class);
|
||||||
when(task.call()).thenAnswer(i -> {
|
when(task.call()).thenAnswer(i -> {
|
||||||
Thread.sleep(1500);
|
Thread.sleep(1500);
|
||||||
return result;
|
return result;
|
||||||
|
});
|
||||||
|
|
||||||
|
final AsyncCallback<Object> callback = mock(AsyncCallback.class);
|
||||||
|
final AsyncResult<Object> asyncResult = executor.startProcess(task, callback);
|
||||||
|
assertNotNull(asyncResult);
|
||||||
|
assertFalse(asyncResult.isCompleted());
|
||||||
|
|
||||||
|
verifyZeroInteractions(callback);
|
||||||
|
|
||||||
|
try {
|
||||||
|
asyncResult.getValue();
|
||||||
|
fail("Expected IllegalStateException when calling AsyncResult#getValue on a non-completed task");
|
||||||
|
} catch (IllegalStateException e) {
|
||||||
|
assertNotNull(e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Our task should only execute once, but it can take a while ...
|
||||||
|
verify(task, timeout(3000).times(1)).call();
|
||||||
|
|
||||||
|
final ArgumentCaptor<Optional<Exception>> optionalCaptor = ArgumentCaptor.forClass((Class) Optional.class);
|
||||||
|
verify(callback, timeout(3000).times(1)).onComplete(eq(result), optionalCaptor.capture());
|
||||||
|
|
||||||
|
final Optional<Exception> optionalException = optionalCaptor.getValue();
|
||||||
|
assertNotNull(optionalException);
|
||||||
|
assertFalse(optionalException.isPresent());
|
||||||
|
|
||||||
|
// Prevent timing issues, and wait until the result is available
|
||||||
|
asyncResult.await();
|
||||||
|
assertTrue(asyncResult.isCompleted());
|
||||||
|
verifyNoMoreInteractions(task, callback);
|
||||||
|
|
||||||
|
// ... and the result should be exactly the same object
|
||||||
|
assertSame(result, asyncResult.getValue());
|
||||||
});
|
});
|
||||||
|
|
||||||
final AsyncCallback<Object> callback = mock(AsyncCallback.class);
|
|
||||||
final AsyncResult<Object> asyncResult = executor.startProcess(task, callback);
|
|
||||||
assertNotNull(asyncResult);
|
|
||||||
assertFalse(asyncResult.isCompleted());
|
|
||||||
|
|
||||||
verifyZeroInteractions(callback);
|
|
||||||
|
|
||||||
try {
|
|
||||||
asyncResult.getValue();
|
|
||||||
fail("Expected IllegalStateException when calling AsyncResult#getValue on a non-completed task");
|
|
||||||
} catch (IllegalStateException e) {
|
|
||||||
assertNotNull(e.getMessage());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Our task should only execute once, but it can take a while ...
|
|
||||||
verify(task, timeout(3000).times(1)).call();
|
|
||||||
|
|
||||||
final ArgumentCaptor<Optional<Exception>> optionalCaptor = ArgumentCaptor.forClass((Class) Optional.class);
|
|
||||||
verify(callback, timeout(3000).times(1)).onComplete(eq(result), optionalCaptor.capture());
|
|
||||||
|
|
||||||
final Optional<Exception> optionalException = optionalCaptor.getValue();
|
|
||||||
assertNotNull(optionalException);
|
|
||||||
assertFalse(optionalException.isPresent());
|
|
||||||
|
|
||||||
// Prevent timing issues, and wait until the result is available
|
|
||||||
asyncResult.await();
|
|
||||||
assertTrue(asyncResult.isCompleted());
|
|
||||||
verifyNoMoreInteractions(task, callback);
|
|
||||||
|
|
||||||
// ... and the result should be exactly the same object
|
|
||||||
assertSame(result, asyncResult.getValue());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test used to verify the happy path of {@link ThreadAsyncExecutor#startProcess(Callable)} when a task takes a while
|
* Test used to verify the happy path of {@link ThreadAsyncExecutor#startProcess(Callable)} when a task takes a while
|
||||||
* to execute, while waiting on the result using {@link ThreadAsyncExecutor#endProcess(AsyncResult)}
|
* to execute, while waiting on the result using {@link ThreadAsyncExecutor#endProcess(AsyncResult)}
|
||||||
*/
|
*/
|
||||||
@Test(timeout = 5000)
|
@Test
|
||||||
public void testEndProcess() throws Exception {
|
public void testEndProcess() throws Exception {
|
||||||
// Instantiate a new executor and start a new 'null' task ...
|
assertTimeout(ofMillis(5000), () -> {
|
||||||
final ThreadAsyncExecutor executor = new ThreadAsyncExecutor();
|
// Instantiate a new executor and start a new 'null' task ...
|
||||||
|
final ThreadAsyncExecutor executor = new ThreadAsyncExecutor();
|
||||||
|
|
||||||
final Object result = new Object();
|
final Object result = new Object();
|
||||||
final Callable<Object> task = mock(Callable.class);
|
final Callable<Object> task = mock(Callable.class);
|
||||||
when(task.call()).thenAnswer(i -> {
|
when(task.call()).thenAnswer(i -> {
|
||||||
Thread.sleep(1500);
|
Thread.sleep(1500);
|
||||||
return result;
|
return result;
|
||||||
|
});
|
||||||
|
|
||||||
|
final AsyncResult<Object> asyncResult = executor.startProcess(task);
|
||||||
|
assertNotNull(asyncResult);
|
||||||
|
assertFalse(asyncResult.isCompleted());
|
||||||
|
|
||||||
|
try {
|
||||||
|
asyncResult.getValue();
|
||||||
|
fail("Expected IllegalStateException when calling AsyncResult#getValue on a non-completed task");
|
||||||
|
} catch (IllegalStateException e) {
|
||||||
|
assertNotNull(e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
assertSame(result, executor.endProcess(asyncResult));
|
||||||
|
verify(task, times(1)).call();
|
||||||
|
assertTrue(asyncResult.isCompleted());
|
||||||
|
|
||||||
|
// Calling end process a second time while already finished should give the same result
|
||||||
|
assertSame(result, executor.endProcess(asyncResult));
|
||||||
|
verifyNoMoreInteractions(task);
|
||||||
});
|
});
|
||||||
|
|
||||||
final AsyncResult<Object> asyncResult = executor.startProcess(task);
|
|
||||||
assertNotNull(asyncResult);
|
|
||||||
assertFalse(asyncResult.isCompleted());
|
|
||||||
|
|
||||||
try {
|
|
||||||
asyncResult.getValue();
|
|
||||||
fail("Expected IllegalStateException when calling AsyncResult#getValue on a non-completed task");
|
|
||||||
} catch (IllegalStateException e) {
|
|
||||||
assertNotNull(e.getMessage());
|
|
||||||
}
|
|
||||||
|
|
||||||
assertSame(result, executor.endProcess(asyncResult));
|
|
||||||
verify(task, times(1)).call();
|
|
||||||
assertTrue(asyncResult.isCompleted());
|
|
||||||
|
|
||||||
// Calling end process a second time while already finished should give the same result
|
|
||||||
assertSame(result, executor.endProcess(asyncResult));
|
|
||||||
verifyNoMoreInteractions(task);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test used to verify the behaviour of {@link ThreadAsyncExecutor#startProcess(Callable)} when the callable is 'null'
|
* Test used to verify the behaviour of {@link ThreadAsyncExecutor#startProcess(Callable)} when the callable is 'null'
|
||||||
*/
|
*/
|
||||||
@Test(timeout = 3000)
|
@Test
|
||||||
public void testNullTask() throws Exception {
|
public void testNullTask() throws Exception {
|
||||||
// Instantiate a new executor and start a new 'null' task ...
|
assertTimeout(ofMillis(3000), () -> {
|
||||||
final ThreadAsyncExecutor executor = new ThreadAsyncExecutor();
|
// Instantiate a new executor and start a new 'null' task ...
|
||||||
final AsyncResult<Object> asyncResult = executor.startProcess(null);
|
final ThreadAsyncExecutor executor = new ThreadAsyncExecutor();
|
||||||
|
final AsyncResult<Object> asyncResult = executor.startProcess(null);
|
||||||
|
|
||||||
assertNotNull("The AsyncResult should not be 'null', even though the task was 'null'.", asyncResult);
|
assertNotNull(asyncResult, "The AsyncResult should not be 'null', even though the task was 'null'.");
|
||||||
asyncResult.await(); // Prevent timing issues, and wait until the result is available
|
asyncResult.await(); // Prevent timing issues, and wait until the result is available
|
||||||
assertTrue(asyncResult.isCompleted());
|
assertTrue(asyncResult.isCompleted());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
asyncResult.getValue();
|
asyncResult.getValue();
|
||||||
fail("Expected ExecutionException with NPE as cause");
|
fail("Expected ExecutionException with NPE as cause");
|
||||||
} catch (final ExecutionException e) {
|
} catch (final ExecutionException e) {
|
||||||
assertNotNull(e.getMessage());
|
assertNotNull(e.getMessage());
|
||||||
assertNotNull(e.getCause());
|
assertNotNull(e.getCause());
|
||||||
assertEquals(NullPointerException.class, e.getCause().getClass());
|
assertEquals(NullPointerException.class, e.getCause().getClass());
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -250,36 +275,38 @@ public class ThreadAsyncExecutorTest {
|
|||||||
* Test used to verify the behaviour of {@link ThreadAsyncExecutor#startProcess(Callable, AsyncCallback)} when the
|
* Test used to verify the behaviour of {@link ThreadAsyncExecutor#startProcess(Callable, AsyncCallback)} when the
|
||||||
* callable is 'null', but the asynchronous callback is provided
|
* callable is 'null', but the asynchronous callback is provided
|
||||||
*/
|
*/
|
||||||
@Test(timeout = 3000)
|
@Test
|
||||||
public void testNullTaskWithCallback() throws Exception {
|
public void testNullTaskWithCallback() throws Exception {
|
||||||
// Instantiate a new executor and start a new 'null' task ...
|
assertTimeout(ofMillis(3000), () -> {
|
||||||
final ThreadAsyncExecutor executor = new ThreadAsyncExecutor();
|
// Instantiate a new executor and start a new 'null' task ...
|
||||||
final AsyncCallback<Object> callback = mock(AsyncCallback.class);
|
final ThreadAsyncExecutor executor = new ThreadAsyncExecutor();
|
||||||
final AsyncResult<Object> asyncResult = executor.startProcess(null, callback);
|
final AsyncCallback<Object> callback = mock(AsyncCallback.class);
|
||||||
|
final AsyncResult<Object> asyncResult = executor.startProcess(null, callback);
|
||||||
|
|
||||||
assertNotNull("The AsyncResult should not be 'null', even though the task was 'null'.", asyncResult);
|
assertNotNull(asyncResult, "The AsyncResult should not be 'null', even though the task was 'null'.");
|
||||||
asyncResult.await(); // Prevent timing issues, and wait until the result is available
|
asyncResult.await(); // Prevent timing issues, and wait until the result is available
|
||||||
assertTrue(asyncResult.isCompleted());
|
assertTrue(asyncResult.isCompleted());
|
||||||
|
|
||||||
final ArgumentCaptor<Optional<Exception>> optionalCaptor = ArgumentCaptor.forClass((Class) Optional.class);
|
final ArgumentCaptor<Optional<Exception>> optionalCaptor = ArgumentCaptor.forClass((Class) Optional.class);
|
||||||
verify(callback, times(1)).onComplete(Matchers.isNull(), optionalCaptor.capture());
|
verify(callback, times(1)).onComplete(Matchers.isNull(), optionalCaptor.capture());
|
||||||
|
|
||||||
final Optional<Exception> optionalException = optionalCaptor.getValue();
|
final Optional<Exception> optionalException = optionalCaptor.getValue();
|
||||||
assertNotNull(optionalException);
|
assertNotNull(optionalException);
|
||||||
assertTrue(optionalException.isPresent());
|
assertTrue(optionalException.isPresent());
|
||||||
|
|
||||||
final Exception exception = optionalException.get();
|
final Exception exception = optionalException.get();
|
||||||
assertNotNull(exception);
|
assertNotNull(exception);
|
||||||
assertEquals(NullPointerException.class, exception.getClass());
|
assertEquals(NullPointerException.class, exception.getClass());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
asyncResult.getValue();
|
asyncResult.getValue();
|
||||||
fail("Expected ExecutionException with NPE as cause");
|
fail("Expected ExecutionException with NPE as cause");
|
||||||
} catch (final ExecutionException e) {
|
} catch (final ExecutionException e) {
|
||||||
assertNotNull(e.getMessage());
|
assertNotNull(e.getMessage());
|
||||||
assertNotNull(e.getCause());
|
assertNotNull(e.getCause());
|
||||||
assertEquals(NullPointerException.class, e.getCause().getClass());
|
assertEquals(NullPointerException.class, e.getCause().getClass());
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -287,24 +314,29 @@ public class ThreadAsyncExecutorTest {
|
|||||||
* Test used to verify the behaviour of {@link ThreadAsyncExecutor#startProcess(Callable, AsyncCallback)} when both
|
* Test used to verify the behaviour of {@link ThreadAsyncExecutor#startProcess(Callable, AsyncCallback)} when both
|
||||||
* the callable and the asynchronous callback are 'null'
|
* the callable and the asynchronous callback are 'null'
|
||||||
*/
|
*/
|
||||||
@Test(timeout = 3000)
|
@Test
|
||||||
public void testNullTaskWithNullCallback() throws Exception {
|
public void testNullTaskWithNullCallback() throws Exception {
|
||||||
// Instantiate a new executor and start a new 'null' task ...
|
assertTimeout(ofMillis(3000), () -> {
|
||||||
final ThreadAsyncExecutor executor = new ThreadAsyncExecutor();
|
// Instantiate a new executor and start a new 'null' task ...
|
||||||
final AsyncResult<Object> asyncResult = executor.startProcess(null, null);
|
final ThreadAsyncExecutor executor = new ThreadAsyncExecutor();
|
||||||
|
final AsyncResult<Object> asyncResult = executor.startProcess(null, null);
|
||||||
|
|
||||||
assertNotNull("The AsyncResult should not be 'null', even though the task and callback were 'null'.", asyncResult);
|
assertNotNull(
|
||||||
asyncResult.await(); // Prevent timing issues, and wait until the result is available
|
asyncResult,
|
||||||
assertTrue(asyncResult.isCompleted());
|
"The AsyncResult should not be 'null', even though the task and callback were 'null'."
|
||||||
|
);
|
||||||
|
asyncResult.await(); // Prevent timing issues, and wait until the result is available
|
||||||
|
assertTrue(asyncResult.isCompleted());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
asyncResult.getValue();
|
asyncResult.getValue();
|
||||||
fail("Expected ExecutionException with NPE as cause");
|
fail("Expected ExecutionException with NPE as cause");
|
||||||
} catch (final ExecutionException e) {
|
} catch (final ExecutionException e) {
|
||||||
assertNotNull(e.getMessage());
|
assertNotNull(e.getMessage());
|
||||||
assertNotNull(e.getCause());
|
assertNotNull(e.getCause());
|
||||||
assertEquals(NullPointerException.class, e.getCause().getClass());
|
assertEquals(NullPointerException.class, e.getCause().getClass());
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,8 +36,13 @@
|
|||||||
<artifactId>balking</artifactId>
|
<artifactId>balking</artifactId>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>org.junit.jupiter</groupId>
|
||||||
<artifactId>junit</artifactId>
|
<artifactId>junit-jupiter-api</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.junit.jupiter</groupId>
|
||||||
|
<artifactId>junit-jupiter-engine</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
package com.iluwatar.balking;
|
package com.iluwatar.balking;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Application test
|
* Application test
|
||||||
|
@ -22,13 +22,13 @@
|
|||||||
*/
|
*/
|
||||||
package com.iluwatar.balking;
|
package com.iluwatar.balking;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import java.util.concurrent.ExecutorService;
|
import java.util.concurrent.ExecutorService;
|
||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests for {@link WashingMachine}
|
* Tests for {@link WashingMachine}
|
||||||
|
@ -34,8 +34,13 @@
|
|||||||
<artifactId>bridge</artifactId>
|
<artifactId>bridge</artifactId>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>org.junit.jupiter</groupId>
|
||||||
<artifactId>junit</artifactId>
|
<artifactId>junit-jupiter-api</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.junit.jupiter</groupId>
|
||||||
|
<artifactId>junit-jupiter-engine</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
*/
|
*/
|
||||||
package com.iluwatar.bridge;
|
package com.iluwatar.bridge;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -22,11 +22,10 @@
|
|||||||
*/
|
*/
|
||||||
package com.iluwatar.bridge;
|
package com.iluwatar.bridge;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import static org.mockito.Mockito.mock;
|
import static org.mockito.Mockito.mock;
|
||||||
import static org.mockito.Mockito.spy;
|
import static org.mockito.Mockito.spy;
|
||||||
import static org.mockito.Mockito.verify;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests for hammer
|
* Tests for hammer
|
||||||
|
@ -22,11 +22,10 @@
|
|||||||
*/
|
*/
|
||||||
package com.iluwatar.bridge;
|
package com.iluwatar.bridge;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import static org.mockito.Mockito.mock;
|
import static org.mockito.Mockito.mock;
|
||||||
import static org.mockito.Mockito.spy;
|
import static org.mockito.Mockito.spy;
|
||||||
import static org.mockito.Mockito.verify;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests for sword
|
* Tests for sword
|
||||||
|
@ -22,10 +22,11 @@
|
|||||||
*/
|
*/
|
||||||
package com.iluwatar.bridge;
|
package com.iluwatar.bridge;
|
||||||
|
|
||||||
import static org.junit.Assert.assertNotNull;
|
import org.junit.jupiter.api.Disabled;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||||
import static org.mockito.Mockito.verify;
|
import static org.mockito.Mockito.verify;
|
||||||
import static org.mockito.Mockito.verifyNoMoreInteractions;
|
import static org.mockito.Mockito.verifyNoMoreInteractions;
|
||||||
import static org.mockito.internal.verification.VerificationModeFactory.times;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base class for weapon tests
|
* Base class for weapon tests
|
||||||
|
@ -34,8 +34,13 @@
|
|||||||
<artifactId>builder</artifactId>
|
<artifactId>builder</artifactId>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>org.junit.jupiter</groupId>
|
||||||
<artifactId>junit</artifactId>
|
<artifactId>junit-jupiter-api</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.junit.jupiter</groupId>
|
||||||
|
<artifactId>junit-jupiter-engine</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
*/
|
*/
|
||||||
package com.iluwatar.builder;
|
package com.iluwatar.builder;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -22,10 +22,11 @@
|
|||||||
*/
|
*/
|
||||||
package com.iluwatar.builder;
|
package com.iluwatar.builder;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import static org.junit.Assert.assertNotNull;
|
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Date: 12/6/15 - 11:01 PM
|
* Date: 12/6/15 - 11:01 PM
|
||||||
@ -37,17 +38,17 @@ public class HeroTest {
|
|||||||
/**
|
/**
|
||||||
* Test if we get the expected exception when trying to create a hero without a profession
|
* Test if we get the expected exception when trying to create a hero without a profession
|
||||||
*/
|
*/
|
||||||
@Test(expected = IllegalArgumentException.class)
|
@Test
|
||||||
public void testMissingProfession() throws Exception {
|
public void testMissingProfession() throws Exception {
|
||||||
new Hero.Builder(null, "Sir without a job");
|
assertThrows(IllegalArgumentException.class, () -> new Hero.Builder(null, "Sir without a job"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test if we get the expected exception when trying to create a hero without a name
|
* Test if we get the expected exception when trying to create a hero without a name
|
||||||
*/
|
*/
|
||||||
@Test(expected = IllegalArgumentException.class)
|
@Test
|
||||||
public void testMissingName() throws Exception {
|
public void testMissingName() throws Exception {
|
||||||
new Hero.Builder(Profession.THIEF, null);
|
assertThrows(IllegalArgumentException.class, () -> new Hero.Builder(Profession.THIEF, null));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -35,8 +35,13 @@
|
|||||||
<artifactId>business-delegate</artifactId>
|
<artifactId>business-delegate</artifactId>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>org.junit.jupiter</groupId>
|
||||||
<artifactId>junit</artifactId>
|
<artifactId>junit-jupiter-api</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.junit.jupiter</groupId>
|
||||||
|
<artifactId>junit-jupiter-engine</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
*/
|
*/
|
||||||
package com.iluwatar.business.delegate;
|
package com.iluwatar.business.delegate;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
|
@ -22,13 +22,13 @@
|
|||||||
*/
|
*/
|
||||||
package com.iluwatar.business.delegate;
|
package com.iluwatar.business.delegate;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import static org.mockito.Mockito.spy;
|
import static org.mockito.Mockito.spy;
|
||||||
import static org.mockito.Mockito.times;
|
import static org.mockito.Mockito.times;
|
||||||
import static org.mockito.Mockito.verify;
|
import static org.mockito.Mockito.verify;
|
||||||
|
|
||||||
import org.junit.Before;
|
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Business Delegate pattern adds an abstraction layer between the presentation and business
|
* The Business Delegate pattern adds an abstraction layer between the presentation and business
|
||||||
* tiers. By using the pattern we gain loose coupling between the tiers. The Business Delegate
|
* tiers. By using the pattern we gain loose coupling between the tiers. The Business Delegate
|
||||||
@ -53,7 +53,7 @@ public class BusinessDelegateTest {
|
|||||||
* This method sets up the instance variables of this test class. It is executed before the
|
* This method sets up the instance variables of this test class. It is executed before the
|
||||||
* execution of every test.
|
* execution of every test.
|
||||||
*/
|
*/
|
||||||
@Before
|
@BeforeEach
|
||||||
public void setup() {
|
public void setup() {
|
||||||
ejbService = spy(new EjbService());
|
ejbService = spy(new EjbService());
|
||||||
jmsService = spy(new JmsService());
|
jmsService = spy(new JmsService());
|
||||||
|
@ -34,8 +34,13 @@
|
|||||||
<artifactId>caching</artifactId>
|
<artifactId>caching</artifactId>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>org.junit.jupiter</groupId>
|
||||||
<artifactId>junit</artifactId>
|
<artifactId>junit-jupiter-api</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.junit.jupiter</groupId>
|
||||||
|
<artifactId>junit-jupiter-engine</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
*/
|
*/
|
||||||
package com.iluwatar.caching;
|
package com.iluwatar.caching;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
|
@ -22,8 +22,8 @@
|
|||||||
*/
|
*/
|
||||||
package com.iluwatar.caching;
|
package com.iluwatar.caching;
|
||||||
|
|
||||||
import org.junit.Before;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -36,7 +36,7 @@ public class CachingTest {
|
|||||||
/**
|
/**
|
||||||
* Setup of application test includes: initializing DB connection and cache size/capacity.
|
* Setup of application test includes: initializing DB connection and cache size/capacity.
|
||||||
*/
|
*/
|
||||||
@Before
|
@BeforeEach
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
AppManager.initDb(false); // VirtualDB (instead of MongoDB) was used in running the JUnit tests
|
AppManager.initDb(false); // VirtualDB (instead of MongoDB) was used in running the JUnit tests
|
||||||
// to avoid Maven compilation errors. Set flag to true to run the
|
// to avoid Maven compilation errors. Set flag to true to run the
|
||||||
|
@ -34,8 +34,13 @@
|
|||||||
<artifactId>callback</artifactId>
|
<artifactId>callback</artifactId>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>org.junit.jupiter</groupId>
|
||||||
<artifactId>junit</artifactId>
|
<artifactId>junit-jupiter-api</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.junit.jupiter</groupId>
|
||||||
|
<artifactId>junit-jupiter-engine</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
*/
|
*/
|
||||||
package com.iluwatar.callback;
|
package com.iluwatar.callback;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
|
@ -22,9 +22,9 @@
|
|||||||
*/
|
*/
|
||||||
package com.iluwatar.callback;
|
package com.iluwatar.callback;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a field as a counter. Every time the callback method is called increment this field. Unit
|
* Add a field as a counter. Every time the callback method is called increment this field. Unit
|
||||||
@ -47,15 +47,15 @@ public class CallbackTest {
|
|||||||
|
|
||||||
Task task = new SimpleTask();
|
Task task = new SimpleTask();
|
||||||
|
|
||||||
assertEquals("Initial calling count of 0", new Integer(0), callingCount);
|
assertEquals(new Integer(0), callingCount, "Initial calling count of 0");
|
||||||
|
|
||||||
task.executeWith(callback);
|
task.executeWith(callback);
|
||||||
|
|
||||||
assertEquals("Callback called once", new Integer(1), callingCount);
|
assertEquals(new Integer(1), callingCount, "Callback called once");
|
||||||
|
|
||||||
task.executeWith(callback);
|
task.executeWith(callback);
|
||||||
|
|
||||||
assertEquals("Callback called twice", new Integer(2), callingCount);
|
assertEquals(new Integer(2), callingCount, "Callback called twice");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -65,15 +65,15 @@ public class CallbackTest {
|
|||||||
|
|
||||||
Task task = new SimpleTask();
|
Task task = new SimpleTask();
|
||||||
|
|
||||||
assertEquals("Initial calling count of 0", new Integer(0), callingCount);
|
assertEquals(new Integer(0), callingCount, "Initial calling count of 0");
|
||||||
|
|
||||||
task.executeWith(callback);
|
task.executeWith(callback);
|
||||||
|
|
||||||
assertEquals("Callback called once", new Integer(1), callingCount);
|
assertEquals(new Integer(1), callingCount, "Callback called once");
|
||||||
|
|
||||||
task.executeWith(callback);
|
task.executeWith(callback);
|
||||||
|
|
||||||
assertEquals("Callback called twice", new Integer(2), callingCount);
|
assertEquals(new Integer(2), callingCount, "Callback called twice");
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -34,8 +34,13 @@
|
|||||||
<artifactId>chain</artifactId>
|
<artifactId>chain</artifactId>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>org.junit.jupiter</groupId>
|
||||||
<artifactId>junit</artifactId>
|
<artifactId>junit-jupiter-api</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.junit.jupiter</groupId>
|
||||||
|
<artifactId>junit-jupiter-engine</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
*/
|
*/
|
||||||
package com.iluwatar.chain;
|
package com.iluwatar.chain;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -22,9 +22,9 @@
|
|||||||
*/
|
*/
|
||||||
package com.iluwatar.chain;
|
package com.iluwatar.chain;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Date: 12/6/15 - 9:29 PM
|
* Date: 12/6/15 - 9:29 PM
|
||||||
@ -49,8 +49,8 @@ public class OrcKingTest {
|
|||||||
for (final Request request : REQUESTS) {
|
for (final Request request : REQUESTS) {
|
||||||
king.makeRequest(request);
|
king.makeRequest(request);
|
||||||
assertTrue(
|
assertTrue(
|
||||||
"Expected all requests from King to be handled, but [" + request + "] was not!",
|
request.isHandled(),
|
||||||
request.isHandled()
|
"Expected all requests from King to be handled, but [" + request + "] was not!"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -179,7 +179,7 @@
|
|||||||
<property name="allowMissingThrowsTags" value="true"/>
|
<property name="allowMissingThrowsTags" value="true"/>
|
||||||
<property name="allowMissingReturnTag" value="true"/>
|
<property name="allowMissingReturnTag" value="true"/>
|
||||||
<property name="minLineCount" value="2"/>
|
<property name="minLineCount" value="2"/>
|
||||||
<property name="allowedAnnotations" value="Override, Test, Before, After, Parameters, Given, When, BeforeClass, AfterClass, Parameterized"/>
|
<property name="allowedAnnotations" value="Override, Test, Before, After, Parameters, Given, When, BeforeClass, AfterClass, Parameterized, ParameterizedTest, BeforeAll, BeforeEach"/>
|
||||||
<property name="allowThrowsTagsForSubclasses" value="true"/>
|
<property name="allowThrowsTagsForSubclasses" value="true"/>
|
||||||
</module>
|
</module>
|
||||||
<module name="JavadocType">
|
<module name="JavadocType">
|
||||||
|
@ -34,13 +34,13 @@
|
|||||||
<artifactId>command</artifactId>
|
<artifactId>command</artifactId>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>org.junit.jupiter</groupId>
|
||||||
<artifactId>junit</artifactId>
|
<artifactId>junit-jupiter-api</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.mockito</groupId>
|
<groupId>org.junit.jupiter</groupId>
|
||||||
<artifactId>mockito-core</artifactId>
|
<artifactId>junit-jupiter-engine</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
*/
|
*/
|
||||||
package com.iluwatar.command;
|
package com.iluwatar.command;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
|
@ -22,9 +22,9 @@
|
|||||||
*/
|
*/
|
||||||
package com.iluwatar.command;
|
package com.iluwatar.command;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import org.junit.Test;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Command pattern is a behavioral design pattern in which an object is used to encapsulate all
|
* The Command pattern is a behavioral design pattern in which an object is used to encapsulate all
|
||||||
@ -85,9 +85,9 @@ public class CommandTest {
|
|||||||
*/
|
*/
|
||||||
private void verifyGoblin(Goblin goblin, String expectedName, Size expectedSize,
|
private void verifyGoblin(Goblin goblin, String expectedName, Size expectedSize,
|
||||||
Visibility expectedVisibility) {
|
Visibility expectedVisibility) {
|
||||||
assertEquals("Goblin's name must be same as expectedName", expectedName, goblin.toString());
|
assertEquals(expectedName, goblin.toString(), "Goblin's name must be same as expectedName");
|
||||||
assertEquals("Goblin's size must be same as expectedSize", expectedSize, goblin.getSize());
|
assertEquals(expectedSize, goblin.getSize(), "Goblin's size must be same as expectedSize");
|
||||||
assertEquals("Goblin's visibility must be same as expectedVisibility", expectedVisibility,
|
assertEquals(expectedVisibility, goblin.getVisibility(),
|
||||||
goblin.getVisibility());
|
"Goblin's visibility must be same as expectedVisibility");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -34,8 +34,13 @@
|
|||||||
<artifactId>composite</artifactId>
|
<artifactId>composite</artifactId>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>org.junit.jupiter</groupId>
|
||||||
<artifactId>junit</artifactId>
|
<artifactId>junit-jupiter-api</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.junit.jupiter</groupId>
|
||||||
|
<artifactId>junit-jupiter-engine</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
*/
|
*/
|
||||||
package com.iluwatar.composite;
|
package com.iluwatar.composite;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -22,15 +22,15 @@
|
|||||||
*/
|
*/
|
||||||
package com.iluwatar.composite;
|
package com.iluwatar.composite;
|
||||||
|
|
||||||
import org.junit.After;
|
import org.junit.jupiter.api.AfterEach;
|
||||||
import org.junit.Before;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.PrintStream;
|
import java.io.PrintStream;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import static org.junit.Assert.assertNotNull;
|
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Date: 12/11/15 - 8:12 PM
|
* Date: 12/11/15 - 8:12 PM
|
||||||
@ -52,7 +52,7 @@ public class MessengerTest {
|
|||||||
/**
|
/**
|
||||||
* Inject the mocked std-out {@link PrintStream} into the {@link System} class before each test
|
* Inject the mocked std-out {@link PrintStream} into the {@link System} class before each test
|
||||||
*/
|
*/
|
||||||
@Before
|
@BeforeEach
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
this.stdOutBuffer = new ByteArrayOutputStream();
|
this.stdOutBuffer = new ByteArrayOutputStream();
|
||||||
System.setOut(new PrintStream(stdOutBuffer));
|
System.setOut(new PrintStream(stdOutBuffer));
|
||||||
@ -61,7 +61,7 @@ public class MessengerTest {
|
|||||||
/**
|
/**
|
||||||
* Removed the mocked std-out {@link PrintStream} again from the {@link System} class
|
* Removed the mocked std-out {@link PrintStream} again from the {@link System} class
|
||||||
*/
|
*/
|
||||||
@After
|
@AfterEach
|
||||||
public void tearDown() {
|
public void tearDown() {
|
||||||
System.setOut(realStdOut);
|
System.setOut(realStdOut);
|
||||||
}
|
}
|
||||||
|
@ -34,8 +34,13 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>org.junit.jupiter</groupId>
|
||||||
<artifactId>junit</artifactId>
|
<artifactId>junit-jupiter-api</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.junit.jupiter</groupId>
|
||||||
|
<artifactId>junit-jupiter-engine</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
*/
|
*/
|
||||||
package com.iluwatar.converter;
|
package com.iluwatar.converter;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* App running test
|
* App running test
|
||||||
|
@ -23,13 +23,13 @@
|
|||||||
package com.iluwatar.converter;
|
package com.iluwatar.converter;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import static junit.framework.TestCase.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests for {@link Converter}
|
* Tests for {@link Converter}
|
||||||
@ -41,7 +41,8 @@ public class ConverterTest {
|
|||||||
/**
|
/**
|
||||||
* Tests whether a converter created of opposite functions holds equality as a bijection.
|
* Tests whether a converter created of opposite functions holds equality as a bijection.
|
||||||
*/
|
*/
|
||||||
@Test public void testConversionsStartingFromDomain() {
|
@Test
|
||||||
|
public void testConversionsStartingFromDomain() {
|
||||||
User u1 = new User("Tom", "Hanks", true, "tom@hanks.com");
|
User u1 = new User("Tom", "Hanks", true, "tom@hanks.com");
|
||||||
User u2 = userConverter.convertFromDto(userConverter.convertFromEntity(u1));
|
User u2 = userConverter.convertFromDto(userConverter.convertFromEntity(u1));
|
||||||
assertEquals(u1, u2);
|
assertEquals(u1, u2);
|
||||||
@ -50,7 +51,8 @@ public class ConverterTest {
|
|||||||
/**
|
/**
|
||||||
* Tests whether a converter created of opposite functions holds equality as a bijection.
|
* Tests whether a converter created of opposite functions holds equality as a bijection.
|
||||||
*/
|
*/
|
||||||
@Test public void testConversionsStartingFromDto() {
|
@Test
|
||||||
|
public void testConversionsStartingFromDto() {
|
||||||
UserDto u1 = new UserDto("Tom", "Hanks", true, "tom@hanks.com");
|
UserDto u1 = new UserDto("Tom", "Hanks", true, "tom@hanks.com");
|
||||||
UserDto u2 = userConverter.convertFromEntity(userConverter.convertFromDto(u1));
|
UserDto u2 = userConverter.convertFromEntity(userConverter.convertFromDto(u1));
|
||||||
assertEquals(u1, u2);
|
assertEquals(u1, u2);
|
||||||
@ -60,7 +62,8 @@ public class ConverterTest {
|
|||||||
* Tests the custom users converter. Thanks to Java8 lambdas, converter can be easily and
|
* Tests the custom users converter. Thanks to Java8 lambdas, converter can be easily and
|
||||||
* cleanly instantiated allowing various different conversion strategies to be implemented.
|
* cleanly instantiated allowing various different conversion strategies to be implemented.
|
||||||
*/
|
*/
|
||||||
@Test public void testCustomConverter() {
|
@Test
|
||||||
|
public void testCustomConverter() {
|
||||||
Converter<UserDto, User> converter = new Converter<>(
|
Converter<UserDto, User> converter = new Converter<>(
|
||||||
userDto -> new User(userDto.getFirstName(), userDto.getLastName(), userDto.isActive(),
|
userDto -> new User(userDto.getFirstName(), userDto.getLastName(), userDto.isActive(),
|
||||||
String.valueOf(new Random().nextInt())),
|
String.valueOf(new Random().nextInt())),
|
||||||
@ -75,7 +78,8 @@ public class ConverterTest {
|
|||||||
* Test whether converting a collection of Users to DTO Users and then converting them back to domain
|
* Test whether converting a collection of Users to DTO Users and then converting them back to domain
|
||||||
* users returns an equal collection.
|
* users returns an equal collection.
|
||||||
*/
|
*/
|
||||||
@Test public void testCollectionConversion() {
|
@Test
|
||||||
|
public void testCollectionConversion() {
|
||||||
ArrayList<User> users = Lists.newArrayList(new User("Camile", "Tough", false, "124sad"),
|
ArrayList<User> users = Lists.newArrayList(new User("Camile", "Tough", false, "124sad"),
|
||||||
new User("Marti", "Luther", true, "42309fd"), new User("Kate", "Smith", true, "if0243"));
|
new User("Marti", "Luther", true, "42309fd"), new User("Kate", "Smith", true, "if0243"));
|
||||||
List<User> fromDtos = userConverter.createFromDtos(userConverter.createFromEntities(users));
|
List<User> fromDtos = userConverter.createFromDtos(userConverter.createFromEntities(users));
|
||||||
|
@ -26,8 +26,13 @@
|
|||||||
<artifactId>cqrs</artifactId>
|
<artifactId>cqrs</artifactId>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>org.junit.jupiter</groupId>
|
||||||
<artifactId>junit</artifactId>
|
<artifactId>junit-jupiter-api</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.junit.jupiter</groupId>
|
||||||
|
<artifactId>junit-jupiter-engine</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -22,21 +22,20 @@
|
|||||||
*/
|
*/
|
||||||
package com.iluwatar.cqrs;
|
package com.iluwatar.cqrs;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
|
||||||
import static org.junit.Assert.assertTrue;
|
|
||||||
|
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.junit.BeforeClass;
|
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
import com.iluwatar.cqrs.commandes.CommandServiceImpl;
|
import com.iluwatar.cqrs.commandes.CommandServiceImpl;
|
||||||
import com.iluwatar.cqrs.commandes.ICommandService;
|
import com.iluwatar.cqrs.commandes.ICommandService;
|
||||||
import com.iluwatar.cqrs.dto.Author;
|
import com.iluwatar.cqrs.dto.Author;
|
||||||
import com.iluwatar.cqrs.dto.Book;
|
import com.iluwatar.cqrs.dto.Book;
|
||||||
import com.iluwatar.cqrs.queries.IQueryService;
|
import com.iluwatar.cqrs.queries.IQueryService;
|
||||||
import com.iluwatar.cqrs.queries.QueryServiceImpl;
|
import com.iluwatar.cqrs.queries.QueryServiceImpl;
|
||||||
|
import org.junit.jupiter.api.BeforeAll;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Integration test of IQueryService and ICommandService with h2 data
|
* Integration test of IQueryService and ICommandService with h2 data
|
||||||
@ -47,14 +46,11 @@ public class IntegrationTest {
|
|||||||
private static IQueryService queryService;
|
private static IQueryService queryService;
|
||||||
private static ICommandService commandService;
|
private static ICommandService commandService;
|
||||||
|
|
||||||
@BeforeClass
|
@BeforeAll
|
||||||
public static void initialize() {
|
public static void initializeAndPopulateDatabase() {
|
||||||
commandService = new CommandServiceImpl();
|
commandService = new CommandServiceImpl();
|
||||||
queryService = new QueryServiceImpl();
|
queryService = new QueryServiceImpl();
|
||||||
}
|
|
||||||
|
|
||||||
@BeforeClass
|
|
||||||
public static void populateDatabase() {
|
|
||||||
// create first author1
|
// create first author1
|
||||||
commandService.authorCreated("username1", "name1", "email1");
|
commandService.authorCreated("username1", "name1", "email1");
|
||||||
|
|
||||||
@ -94,7 +90,7 @@ public class IntegrationTest {
|
|||||||
public void testGetBook() {
|
public void testGetBook() {
|
||||||
Book book = queryService.getBook("title1");
|
Book book = queryService.getBook("title1");
|
||||||
assertEquals("title1", book.getTitle());
|
assertEquals("title1", book.getTitle());
|
||||||
assertEquals(10, book.getPrice(), 0);
|
assertEquals(10, book.getPrice(), 0.01);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
13
dao/pom.xml
13
dao/pom.xml
@ -36,8 +36,13 @@
|
|||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>org.junit.jupiter</groupId>
|
||||||
<artifactId>junit</artifactId>
|
<artifactId>junit-jupiter-api</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.junit.jupiter</groupId>
|
||||||
|
<artifactId>junit-jupiter-engine</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
@ -48,10 +53,6 @@
|
|||||||
<groupId>com.h2database</groupId>
|
<groupId>com.h2database</groupId>
|
||||||
<artifactId>h2</artifactId>
|
<artifactId>h2</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>de.bechte.junit</groupId>
|
|
||||||
<artifactId>junit-hierarchicalcontextrunner</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.mockito</groupId>
|
<groupId>org.mockito</groupId>
|
||||||
<artifactId>mockito-core</artifactId>
|
<artifactId>mockito-core</artifactId>
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
package com.iluwatar.dao;
|
package com.iluwatar.dao;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests that DAO example runs without errors.
|
* Tests that DAO example runs without errors.
|
||||||
|
@ -23,11 +23,11 @@
|
|||||||
|
|
||||||
package com.iluwatar.dao;
|
package com.iluwatar.dao;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import static org.junit.Assert.assertNotEquals;
|
import static org.junit.jupiter.api.Assertions.assertNotEquals;
|
||||||
|
|
||||||
import org.junit.Before;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests {@link Customer}.
|
* Tests {@link Customer}.
|
||||||
@ -39,7 +39,7 @@ public class CustomerTest {
|
|||||||
private static final String FIRSTNAME = "Winston";
|
private static final String FIRSTNAME = "Winston";
|
||||||
private static final String LASTNAME = "Churchill";
|
private static final String LASTNAME = "Churchill";
|
||||||
|
|
||||||
@Before
|
@BeforeEach
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
customer = new Customer(ID, FIRSTNAME, LASTNAME);
|
customer = new Customer(ID, FIRSTNAME, LASTNAME);
|
||||||
}
|
}
|
||||||
|
@ -22,38 +22,32 @@
|
|||||||
*/
|
*/
|
||||||
package com.iluwatar.dao;
|
package com.iluwatar.dao;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import org.h2.jdbcx.JdbcDataSource;
|
||||||
import static org.junit.Assert.assertFalse;
|
import org.junit.jupiter.api.AfterEach;
|
||||||
import static org.junit.Assert.assertNull;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import static org.junit.Assert.assertTrue;
|
import org.junit.jupiter.api.Nested;
|
||||||
import static org.junit.Assume.assumeTrue;
|
import org.junit.jupiter.api.Test;
|
||||||
import static org.mockito.Mockito.doReturn;
|
import org.mockito.Mockito;
|
||||||
import static org.mockito.Mockito.doThrow;
|
|
||||||
import static org.mockito.Mockito.mock;
|
|
||||||
|
|
||||||
|
import javax.sql.DataSource;
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.DriverManager;
|
import java.sql.DriverManager;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.sql.Statement;
|
import java.sql.Statement;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
import javax.sql.DataSource;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||||
import org.h2.jdbcx.JdbcDataSource;
|
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||||
import org.junit.After;
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
import org.junit.Before;
|
import static org.junit.jupiter.api.Assumptions.assumeTrue;
|
||||||
import org.junit.Rule;
|
import static org.mockito.Mockito.doReturn;
|
||||||
import org.junit.Test;
|
import static org.mockito.Mockito.doThrow;
|
||||||
import org.junit.rules.ExpectedException;
|
import static org.mockito.Mockito.mock;
|
||||||
import org.junit.runner.RunWith;
|
|
||||||
import org.mockito.Mockito;
|
|
||||||
|
|
||||||
import de.bechte.junit.runners.context.HierarchicalContextRunner;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests {@link DbCustomerDao}.
|
* Tests {@link DbCustomerDao}.
|
||||||
*/
|
*/
|
||||||
@RunWith(HierarchicalContextRunner.class)
|
|
||||||
public class DbCustomerDaoTest {
|
public class DbCustomerDaoTest {
|
||||||
|
|
||||||
private static final String DB_URL = "jdbc:h2:~/dao";
|
private static final String DB_URL = "jdbc:h2:~/dao";
|
||||||
@ -64,7 +58,7 @@ public class DbCustomerDaoTest {
|
|||||||
* Creates customers schema.
|
* Creates customers schema.
|
||||||
* @throws SQLException if there is any error while creating schema.
|
* @throws SQLException if there is any error while creating schema.
|
||||||
*/
|
*/
|
||||||
@Before
|
@BeforeEach
|
||||||
public void createSchema() throws SQLException {
|
public void createSchema() throws SQLException {
|
||||||
try (Connection connection = DriverManager.getConnection(DB_URL);
|
try (Connection connection = DriverManager.getConnection(DB_URL);
|
||||||
Statement statement = connection.createStatement()) {
|
Statement statement = connection.createStatement()) {
|
||||||
@ -75,13 +69,14 @@ public class DbCustomerDaoTest {
|
|||||||
/**
|
/**
|
||||||
* Represents the scenario where DB connectivity is present.
|
* Represents the scenario where DB connectivity is present.
|
||||||
*/
|
*/
|
||||||
|
@Nested
|
||||||
public class ConnectionSuccess {
|
public class ConnectionSuccess {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Setup for connection success scenario.
|
* Setup for connection success scenario.
|
||||||
* @throws Exception if any error occurs.
|
* @throws Exception if any error occurs.
|
||||||
*/
|
*/
|
||||||
@Before
|
@BeforeEach
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
JdbcDataSource dataSource = new JdbcDataSource();
|
JdbcDataSource dataSource = new JdbcDataSource();
|
||||||
dataSource.setURL(DB_URL);
|
dataSource.setURL(DB_URL);
|
||||||
@ -93,6 +88,7 @@ public class DbCustomerDaoTest {
|
|||||||
/**
|
/**
|
||||||
* Represents the scenario when DAO operations are being performed on a non existing customer.
|
* Represents the scenario when DAO operations are being performed on a non existing customer.
|
||||||
*/
|
*/
|
||||||
|
@Nested
|
||||||
public class NonExistingCustomer {
|
public class NonExistingCustomer {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -141,6 +137,7 @@ public class DbCustomerDaoTest {
|
|||||||
* customer.
|
* customer.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@Nested
|
||||||
public class ExistingCustomer {
|
public class ExistingCustomer {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -184,20 +181,21 @@ public class DbCustomerDaoTest {
|
|||||||
* DB service unavailable.
|
* DB service unavailable.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@Nested
|
||||||
public class ConnectivityIssue {
|
public class ConnectivityIssue {
|
||||||
|
|
||||||
private static final String EXCEPTION_CAUSE = "Connection not available";
|
private static final String EXCEPTION_CAUSE = "Connection not available";
|
||||||
@Rule public ExpectedException exception = ExpectedException.none();
|
//@Rule public ExpectedException exception = ExpectedException.none();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* setup a connection failure scenario.
|
* setup a connection failure scenario.
|
||||||
* @throws SQLException if any error occurs.
|
* @throws SQLException if any error occurs.
|
||||||
*/
|
*/
|
||||||
@Before
|
@BeforeEach
|
||||||
public void setUp() throws SQLException {
|
public void setUp() throws SQLException {
|
||||||
dao = new DbCustomerDao(mockedDatasource());
|
dao = new DbCustomerDao(mockedDatasource());
|
||||||
exception.expect(Exception.class);
|
//exception.expect(Exception.class);
|
||||||
exception.expectMessage(EXCEPTION_CAUSE);
|
//exception.expectMessage(EXCEPTION_CAUSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
private DataSource mockedDatasource() throws SQLException {
|
private DataSource mockedDatasource() throws SQLException {
|
||||||
@ -210,31 +208,40 @@ public class DbCustomerDaoTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void addingACustomerFailsWithExceptionAsFeedbackToClient() throws Exception {
|
public void addingACustomerFailsWithExceptionAsFeedbackToClient() {
|
||||||
dao.add(new Customer(2, "Bernard", "Montgomery"));
|
assertThrows(Exception.class, () -> {
|
||||||
|
dao.add(new Customer(2, "Bernard", "Montgomery"));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void deletingACustomerFailsWithExceptionAsFeedbackToTheClient() throws Exception {
|
public void deletingACustomerFailsWithExceptionAsFeedbackToTheClient() {
|
||||||
dao.delete(existingCustomer);
|
assertThrows(Exception.class, () -> {
|
||||||
|
dao.delete(existingCustomer);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void updatingACustomerFailsWithFeedbackToTheClient() throws Exception {
|
public void updatingACustomerFailsWithFeedbackToTheClient() {
|
||||||
final String newFirstname = "Bernard";
|
final String newFirstname = "Bernard";
|
||||||
final String newLastname = "Montgomery";
|
final String newLastname = "Montgomery";
|
||||||
|
assertThrows(Exception.class, () -> {
|
||||||
dao.update(new Customer(existingCustomer.getId(), newFirstname, newLastname));
|
dao.update(new Customer(existingCustomer.getId(), newFirstname, newLastname));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void retrievingACustomerByIdFailsWithExceptionAsFeedbackToClient() throws Exception {
|
public void retrievingACustomerByIdFailsWithExceptionAsFeedbackToClient() {
|
||||||
dao.getById(existingCustomer.getId());
|
assertThrows(Exception.class, () -> {
|
||||||
|
dao.getById(existingCustomer.getId());
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void retrievingAllCustomersFailsWithExceptionAsFeedbackToClient() throws Exception {
|
public void retrievingAllCustomersFailsWithExceptionAsFeedbackToClient() {
|
||||||
dao.getAll();
|
assertThrows(Exception.class, () -> {
|
||||||
|
dao.getAll();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -243,7 +250,7 @@ public class DbCustomerDaoTest {
|
|||||||
* Delete customer schema for fresh setup per test.
|
* Delete customer schema for fresh setup per test.
|
||||||
* @throws SQLException if any error occurs.
|
* @throws SQLException if any error occurs.
|
||||||
*/
|
*/
|
||||||
@After
|
@AfterEach
|
||||||
public void deleteSchema() throws SQLException {
|
public void deleteSchema() throws SQLException {
|
||||||
try (Connection connection = DriverManager.getConnection(DB_URL);
|
try (Connection connection = DriverManager.getConnection(DB_URL);
|
||||||
Statement statement = connection.createStatement()) {
|
Statement statement = connection.createStatement()) {
|
||||||
|
@ -23,31 +23,27 @@
|
|||||||
|
|
||||||
package com.iluwatar.dao;
|
package com.iluwatar.dao;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import static org.junit.Assert.assertFalse;
|
import org.junit.jupiter.api.Nested;
|
||||||
import static org.junit.Assert.assertNull;
|
import org.junit.jupiter.api.Test;
|
||||||
import static org.junit.Assert.assertTrue;
|
|
||||||
import static org.junit.Assume.assumeTrue;
|
|
||||||
|
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
import org.junit.Before;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import org.junit.Test;
|
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||||
import org.junit.runner.RunWith;
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
|
import static org.junit.jupiter.api.Assumptions.assumeTrue;
|
||||||
import de.bechte.junit.runners.context.HierarchicalContextRunner;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests {@link InMemoryCustomerDao}.
|
* Tests {@link InMemoryCustomerDao}.
|
||||||
*/
|
*/
|
||||||
@RunWith(HierarchicalContextRunner.class)
|
|
||||||
public class InMemoryCustomerDaoTest {
|
public class InMemoryCustomerDaoTest {
|
||||||
|
|
||||||
private InMemoryCustomerDao dao;
|
private InMemoryCustomerDao dao;
|
||||||
private static final Customer CUSTOMER = new Customer(1, "Freddy", "Krueger");
|
private static final Customer CUSTOMER = new Customer(1, "Freddy", "Krueger");
|
||||||
|
|
||||||
@Before
|
@BeforeEach
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
dao = new InMemoryCustomerDao();
|
dao = new InMemoryCustomerDao();
|
||||||
assertTrue(dao.add(CUSTOMER));
|
assertTrue(dao.add(CUSTOMER));
|
||||||
@ -57,6 +53,7 @@ public class InMemoryCustomerDaoTest {
|
|||||||
* Represents the scenario when the DAO operations are being performed on a non existent
|
* Represents the scenario when the DAO operations are being performed on a non existent
|
||||||
* customer.
|
* customer.
|
||||||
*/
|
*/
|
||||||
|
@Nested
|
||||||
public class NonExistingCustomer {
|
public class NonExistingCustomer {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -104,6 +101,7 @@ public class InMemoryCustomerDaoTest {
|
|||||||
* Represents the scenario when the DAO operations are being performed on an already existing
|
* Represents the scenario when the DAO operations are being performed on an already existing
|
||||||
* customer.
|
* customer.
|
||||||
*/
|
*/
|
||||||
|
@Nested
|
||||||
public class ExistingCustomer {
|
public class ExistingCustomer {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -38,8 +38,13 @@
|
|||||||
<artifactId>data-bus</artifactId>
|
<artifactId>data-bus</artifactId>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>org.junit.jupiter</groupId>
|
||||||
<artifactId>junit</artifactId>
|
<artifactId>junit-jupiter-api</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.junit.jupiter</groupId>
|
||||||
|
<artifactId>junit-jupiter-engine</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -22,8 +22,8 @@
|
|||||||
*/
|
*/
|
||||||
package com.iluwatar.databus;
|
package com.iluwatar.databus;
|
||||||
|
|
||||||
import org.junit.Before;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.mockito.Mock;
|
import org.mockito.Mock;
|
||||||
import org.mockito.MockitoAnnotations;
|
import org.mockito.MockitoAnnotations;
|
||||||
|
|
||||||
@ -43,7 +43,7 @@ public class DataBusTest {
|
|||||||
@Mock
|
@Mock
|
||||||
private DataType event;
|
private DataType event;
|
||||||
|
|
||||||
@Before
|
@BeforeEach
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
MockitoAnnotations.initMocks(this);
|
MockitoAnnotations.initMocks(this);
|
||||||
}
|
}
|
||||||
|
@ -24,11 +24,13 @@ package com.iluwatar.databus.members;
|
|||||||
|
|
||||||
import com.iluwatar.databus.data.MessageData;
|
import com.iluwatar.databus.data.MessageData;
|
||||||
import com.iluwatar.databus.data.StartingData;
|
import com.iluwatar.databus.data.StartingData;
|
||||||
import org.junit.Assert;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests for {@link MessageCollectorMember}.
|
* Tests for {@link MessageCollectorMember}.
|
||||||
*
|
*
|
||||||
@ -45,7 +47,7 @@ public class MessageCollectorMemberTest {
|
|||||||
//when
|
//when
|
||||||
collector.accept(messageData);
|
collector.accept(messageData);
|
||||||
//then
|
//then
|
||||||
Assert.assertTrue(collector.getMessages().contains(message));
|
assertTrue(collector.getMessages().contains(message));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -56,7 +58,7 @@ public class MessageCollectorMemberTest {
|
|||||||
//when
|
//when
|
||||||
collector.accept(startingData);
|
collector.accept(startingData);
|
||||||
//then
|
//then
|
||||||
Assert.assertEquals(0, collector.getMessages().size());
|
assertEquals(0, collector.getMessages().size());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -26,12 +26,14 @@ import com.iluwatar.databus.DataBus;
|
|||||||
import com.iluwatar.databus.data.MessageData;
|
import com.iluwatar.databus.data.MessageData;
|
||||||
import com.iluwatar.databus.data.StartingData;
|
import com.iluwatar.databus.data.StartingData;
|
||||||
import com.iluwatar.databus.data.StoppingData;
|
import com.iluwatar.databus.data.StoppingData;
|
||||||
import org.junit.Assert;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.Month;
|
import java.time.Month;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests for {@link StatusMember}.
|
* Tests for {@link StatusMember}.
|
||||||
*
|
*
|
||||||
@ -48,7 +50,7 @@ public class StatusMemberTest {
|
|||||||
//when
|
//when
|
||||||
statusMember.accept(startingData);
|
statusMember.accept(startingData);
|
||||||
//then
|
//then
|
||||||
Assert.assertEquals(startTime, statusMember.getStarted());
|
assertEquals(startTime, statusMember.getStarted());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -61,7 +63,7 @@ public class StatusMemberTest {
|
|||||||
//when
|
//when
|
||||||
statusMember.accept(stoppingData);
|
statusMember.accept(stoppingData);
|
||||||
//then
|
//then
|
||||||
Assert.assertEquals(stop, statusMember.getStopped());
|
assertEquals(stop, statusMember.getStopped());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -72,8 +74,8 @@ public class StatusMemberTest {
|
|||||||
//when
|
//when
|
||||||
statusMember.accept(messageData);
|
statusMember.accept(messageData);
|
||||||
//then
|
//then
|
||||||
Assert.assertNull(statusMember.getStarted());
|
assertNull(statusMember.getStarted());
|
||||||
Assert.assertNull(statusMember.getStopped());
|
assertNull(statusMember.getStopped());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -33,8 +33,13 @@
|
|||||||
<artifactId>data-mapper</artifactId>
|
<artifactId>data-mapper</artifactId>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>org.junit.jupiter</groupId>
|
||||||
<artifactId>junit</artifactId>
|
<artifactId>junit-jupiter-api</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.junit.jupiter</groupId>
|
||||||
|
<artifactId>junit-jupiter-engine</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -18,8 +18,7 @@
|
|||||||
*/
|
*/
|
||||||
package com.iluwatar.datamapper;
|
package com.iluwatar.datamapper;
|
||||||
|
|
||||||
import com.iluwatar.datamapper.App;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests that Data-Mapper example runs without errors.
|
* Tests that Data-Mapper example runs without errors.
|
||||||
|
@ -18,13 +18,9 @@
|
|||||||
*/
|
*/
|
||||||
package com.iluwatar.datamapper;
|
package com.iluwatar.datamapper;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import org.junit.Test;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
import com.iluwatar.datamapper.Student;
|
|
||||||
import com.iluwatar.datamapper.StudentDataMapper;
|
|
||||||
import com.iluwatar.datamapper.StudentDataMapperImpl;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Data Mapper (DM) is a layer of software that separates the in-memory objects from the
|
* The Data Mapper (DM) is a layer of software that separates the in-memory objects from the
|
||||||
|
@ -18,10 +18,10 @@
|
|||||||
*/
|
*/
|
||||||
package com.iluwatar.datamapper;
|
package com.iluwatar.datamapper;
|
||||||
|
|
||||||
import static org.junit.Assert.assertFalse;
|
import org.junit.jupiter.api.Test;
|
||||||
import static org.junit.Assert.assertTrue;
|
|
||||||
|
|
||||||
import org.junit.Test;
|
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests {@link Student}.
|
* Tests {@link Student}.
|
||||||
|
@ -33,8 +33,13 @@
|
|||||||
<artifactId>data-transfer-object</artifactId>
|
<artifactId>data-transfer-object</artifactId>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>org.junit.jupiter</groupId>
|
||||||
<artifactId>junit</artifactId>
|
<artifactId>junit-jupiter-api</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.junit.jupiter</groupId>
|
||||||
|
<artifactId>junit-jupiter-engine</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -24,12 +24,12 @@
|
|||||||
|
|
||||||
package com.iluwatar.datatransfer;
|
package com.iluwatar.datatransfer;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* tests {@link CustomerResource}.
|
* tests {@link CustomerResource}.
|
||||||
|
@ -34,8 +34,13 @@
|
|||||||
<artifactId>decorator</artifactId>
|
<artifactId>decorator</artifactId>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>org.junit.jupiter</groupId>
|
||||||
<artifactId>junit</artifactId>
|
<artifactId>junit-jupiter-api</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.junit.jupiter</groupId>
|
||||||
|
<artifactId>junit-jupiter-engine</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
*/
|
*/
|
||||||
package com.iluwatar.decorator;
|
package com.iluwatar.decorator;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -22,10 +22,12 @@
|
|||||||
*/
|
*/
|
||||||
package com.iluwatar.decorator;
|
package com.iluwatar.decorator;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import static org.mockito.Mockito.*;
|
import static org.mockito.Mockito.spy;
|
||||||
|
import static org.mockito.Mockito.verify;
|
||||||
|
import static org.mockito.Mockito.verifyNoMoreInteractions;
|
||||||
import static org.mockito.internal.verification.VerificationModeFactory.times;
|
import static org.mockito.internal.verification.VerificationModeFactory.times;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -25,15 +25,15 @@ package com.iluwatar.decorator;
|
|||||||
import ch.qos.logback.classic.Logger;
|
import ch.qos.logback.classic.Logger;
|
||||||
import ch.qos.logback.classic.spi.ILoggingEvent;
|
import ch.qos.logback.classic.spi.ILoggingEvent;
|
||||||
import ch.qos.logback.core.AppenderBase;
|
import ch.qos.logback.core.AppenderBase;
|
||||||
import org.junit.After;
|
import org.junit.jupiter.api.AfterEach;
|
||||||
import org.junit.Before;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests for {@link SimpleTroll}
|
* Tests for {@link SimpleTroll}
|
||||||
@ -42,12 +42,12 @@ public class SimpleTrollTest {
|
|||||||
|
|
||||||
private InMemoryAppender appender;
|
private InMemoryAppender appender;
|
||||||
|
|
||||||
@Before
|
@BeforeEach
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
appender = new InMemoryAppender(SimpleTroll.class);
|
appender = new InMemoryAppender(SimpleTroll.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@After
|
@AfterEach
|
||||||
public void tearDown() {
|
public void tearDown() {
|
||||||
appender.stop();
|
appender.stop();
|
||||||
}
|
}
|
||||||
|
@ -38,13 +38,13 @@
|
|||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>org.junit.jupiter</groupId>
|
||||||
<artifactId>junit</artifactId>
|
<artifactId>junit-jupiter-api</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.github.stefanbirkner</groupId>
|
<groupId>org.junit.jupiter</groupId>
|
||||||
<artifactId>system-rules</artifactId>
|
<artifactId>junit-jupiter-engine</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
@ -22,7 +22,8 @@
|
|||||||
*/
|
*/
|
||||||
package com.iluwatar.delegation.simple;
|
package com.iluwatar.delegation.simple;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Application Test Entry
|
* Application Test Entry
|
||||||
*/
|
*/
|
||||||
|
@ -22,20 +22,21 @@
|
|||||||
*/
|
*/
|
||||||
package com.iluwatar.delegation.simple;
|
package com.iluwatar.delegation.simple;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
|
||||||
|
|
||||||
import ch.qos.logback.classic.Logger;
|
import ch.qos.logback.classic.Logger;
|
||||||
import ch.qos.logback.classic.spi.ILoggingEvent;
|
import ch.qos.logback.classic.spi.ILoggingEvent;
|
||||||
import ch.qos.logback.core.AppenderBase;
|
import ch.qos.logback.core.AppenderBase;
|
||||||
import com.iluwatar.delegation.simple.printers.CanonPrinter;
|
import com.iluwatar.delegation.simple.printers.CanonPrinter;
|
||||||
import com.iluwatar.delegation.simple.printers.EpsonPrinter;
|
import com.iluwatar.delegation.simple.printers.EpsonPrinter;
|
||||||
import com.iluwatar.delegation.simple.printers.HpPrinter;
|
import com.iluwatar.delegation.simple.printers.HpPrinter;
|
||||||
|
import org.junit.jupiter.api.AfterEach;
|
||||||
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.junit.After;
|
|
||||||
import org.junit.Before;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import org.junit.Test;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test for Delegation Pattern
|
* Test for Delegation Pattern
|
||||||
@ -44,12 +45,12 @@ public class DelegateTest {
|
|||||||
|
|
||||||
private InMemoryAppender appender;
|
private InMemoryAppender appender;
|
||||||
|
|
||||||
@Before
|
@BeforeEach
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
appender = new InMemoryAppender();
|
appender = new InMemoryAppender();
|
||||||
}
|
}
|
||||||
|
|
||||||
@After
|
@AfterEach
|
||||||
public void tearDown() {
|
public void tearDown() {
|
||||||
appender.stop();
|
appender.stop();
|
||||||
}
|
}
|
||||||
|
@ -34,13 +34,13 @@
|
|||||||
<artifactId>dependency-injection</artifactId>
|
<artifactId>dependency-injection</artifactId>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>org.junit.jupiter</groupId>
|
||||||
<artifactId>junit</artifactId>
|
<artifactId>junit-jupiter-api</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.mockito</groupId>
|
<groupId>org.junit.jupiter</groupId>
|
||||||
<artifactId>mockito-core</artifactId>
|
<artifactId>junit-jupiter-engine</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -23,11 +23,12 @@
|
|||||||
package com.iluwatar.dependency.injection;
|
package com.iluwatar.dependency.injection;
|
||||||
|
|
||||||
import com.iluwatar.dependency.injection.utils.InMemoryAppender;
|
import com.iluwatar.dependency.injection.utils.InMemoryAppender;
|
||||||
import org.junit.After;
|
import org.junit.jupiter.api.AfterEach;
|
||||||
import org.junit.Before;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Date: 28/04/17 - 7:40 AM
|
* Date: 28/04/17 - 7:40 AM
|
||||||
@ -39,12 +40,12 @@ public class AdvancedSorceressTest {
|
|||||||
|
|
||||||
private InMemoryAppender appender;
|
private InMemoryAppender appender;
|
||||||
|
|
||||||
@Before
|
@BeforeEach
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
appender = new InMemoryAppender(Tobacco.class);
|
appender = new InMemoryAppender(Tobacco.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@After
|
@AfterEach
|
||||||
public void tearDown() {
|
public void tearDown() {
|
||||||
appender.stop();
|
appender.stop();
|
||||||
}
|
}
|
||||||
|
@ -23,11 +23,12 @@
|
|||||||
package com.iluwatar.dependency.injection;
|
package com.iluwatar.dependency.injection;
|
||||||
|
|
||||||
import com.iluwatar.dependency.injection.utils.InMemoryAppender;
|
import com.iluwatar.dependency.injection.utils.InMemoryAppender;
|
||||||
import org.junit.After;
|
import org.junit.jupiter.api.AfterEach;
|
||||||
import org.junit.Before;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Date: 12/10/15 - 8:40 PM
|
* Date: 12/10/15 - 8:40 PM
|
||||||
@ -38,12 +39,12 @@ public class AdvancedWizardTest {
|
|||||||
|
|
||||||
private InMemoryAppender appender;
|
private InMemoryAppender appender;
|
||||||
|
|
||||||
@Before
|
@BeforeEach
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
appender = new InMemoryAppender(Tobacco.class);
|
appender = new InMemoryAppender(Tobacco.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@After
|
@AfterEach
|
||||||
public void tearDown() {
|
public void tearDown() {
|
||||||
appender.stop();
|
appender.stop();
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
*/
|
*/
|
||||||
package com.iluwatar.dependency.injection;
|
package com.iluwatar.dependency.injection;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -26,11 +26,11 @@ import com.google.inject.AbstractModule;
|
|||||||
import com.google.inject.Guice;
|
import com.google.inject.Guice;
|
||||||
import com.google.inject.Injector;
|
import com.google.inject.Injector;
|
||||||
import com.iluwatar.dependency.injection.utils.InMemoryAppender;
|
import com.iluwatar.dependency.injection.utils.InMemoryAppender;
|
||||||
import org.junit.After;
|
import org.junit.jupiter.api.AfterEach;
|
||||||
import org.junit.Before;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Date: 12/10/15 - 8:57 PM
|
* Date: 12/10/15 - 8:57 PM
|
||||||
@ -41,12 +41,12 @@ public class GuiceWizardTest {
|
|||||||
|
|
||||||
private InMemoryAppender appender;
|
private InMemoryAppender appender;
|
||||||
|
|
||||||
@Before
|
@BeforeEach
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
appender = new InMemoryAppender(Tobacco.class);
|
appender = new InMemoryAppender(Tobacco.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@After
|
@AfterEach
|
||||||
public void tearDown() {
|
public void tearDown() {
|
||||||
appender.stop();
|
appender.stop();
|
||||||
}
|
}
|
||||||
|
@ -23,11 +23,11 @@
|
|||||||
package com.iluwatar.dependency.injection;
|
package com.iluwatar.dependency.injection;
|
||||||
|
|
||||||
import com.iluwatar.dependency.injection.utils.InMemoryAppender;
|
import com.iluwatar.dependency.injection.utils.InMemoryAppender;
|
||||||
import org.junit.After;
|
import org.junit.jupiter.api.AfterEach;
|
||||||
import org.junit.Before;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Date: 12/10/15 - 8:26 PM
|
* Date: 12/10/15 - 8:26 PM
|
||||||
@ -38,12 +38,12 @@ public class SimpleWizardTest {
|
|||||||
|
|
||||||
private InMemoryAppender appender;
|
private InMemoryAppender appender;
|
||||||
|
|
||||||
@Before
|
@BeforeEach
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
appender = new InMemoryAppender(Tobacco.class);
|
appender = new InMemoryAppender(Tobacco.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@After
|
@AfterEach
|
||||||
public void tearDown() {
|
public void tearDown() {
|
||||||
appender.stop();
|
appender.stop();
|
||||||
}
|
}
|
||||||
|
@ -32,8 +32,13 @@
|
|||||||
<artifactId>double-checked-locking</artifactId>
|
<artifactId>double-checked-locking</artifactId>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>org.junit.jupiter</groupId>
|
||||||
<artifactId>junit</artifactId>
|
<artifactId>junit-jupiter-api</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.junit.jupiter</groupId>
|
||||||
|
<artifactId>junit-jupiter-engine</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
*/
|
*/
|
||||||
package com.iluwatar.doublechecked.locking;
|
package com.iluwatar.doublechecked.locking;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -25,9 +25,9 @@ package com.iluwatar.doublechecked.locking;
|
|||||||
import ch.qos.logback.classic.Logger;
|
import ch.qos.logback.classic.Logger;
|
||||||
import ch.qos.logback.classic.spi.ILoggingEvent;
|
import ch.qos.logback.classic.spi.ILoggingEvent;
|
||||||
import ch.qos.logback.core.AppenderBase;
|
import ch.qos.logback.core.AppenderBase;
|
||||||
import org.junit.After;
|
import org.junit.jupiter.api.AfterEach;
|
||||||
import org.junit.Before;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
@ -36,9 +36,11 @@ import java.util.concurrent.ExecutorService;
|
|||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import static junit.framework.TestCase.assertEquals;
|
import static java.time.Duration.ofMillis;
|
||||||
import static org.junit.Assert.assertNotNull;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertTimeout;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Date: 12/10/15 - 9:34 PM
|
* Date: 12/10/15 - 9:34 PM
|
||||||
@ -49,12 +51,12 @@ public class InventoryTest {
|
|||||||
|
|
||||||
private InMemoryAppender appender;
|
private InMemoryAppender appender;
|
||||||
|
|
||||||
@Before
|
@BeforeEach
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
appender = new InMemoryAppender(Inventory.class);
|
appender = new InMemoryAppender(Inventory.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@After
|
@AfterEach
|
||||||
public void tearDown() {
|
public void tearDown() {
|
||||||
appender.stop();
|
appender.stop();
|
||||||
}
|
}
|
||||||
@ -76,32 +78,34 @@ public class InventoryTest {
|
|||||||
* of order, it means that the locking is not ok, increasing the risk of going over the inventory
|
* of order, it means that the locking is not ok, increasing the risk of going over the inventory
|
||||||
* item limit.
|
* item limit.
|
||||||
*/
|
*/
|
||||||
@Test(timeout = 10000)
|
@Test
|
||||||
public void testAddItem() throws Exception {
|
public void testAddItem() throws Exception {
|
||||||
// Create a new inventory with a limit of 1000 items and put some load on the add method
|
assertTimeout(ofMillis(10000), () -> {
|
||||||
final Inventory inventory = new Inventory(INVENTORY_SIZE);
|
// Create a new inventory with a limit of 1000 items and put some load on the add method
|
||||||
final ExecutorService executorService = Executors.newFixedThreadPool(THREAD_COUNT);
|
final Inventory inventory = new Inventory(INVENTORY_SIZE);
|
||||||
for (int i = 0; i < THREAD_COUNT; i++) {
|
final ExecutorService executorService = Executors.newFixedThreadPool(THREAD_COUNT);
|
||||||
executorService.execute(() -> {
|
for (int i = 0; i < THREAD_COUNT; i++) {
|
||||||
while (inventory.addItem(new Item())) {};
|
executorService.execute(() -> {
|
||||||
});
|
while (inventory.addItem(new Item())) {};
|
||||||
}
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// Wait until all threads have finished
|
// Wait until all threads have finished
|
||||||
executorService.shutdown();
|
executorService.shutdown();
|
||||||
executorService.awaitTermination(5, TimeUnit.SECONDS);
|
executorService.awaitTermination(5, TimeUnit.SECONDS);
|
||||||
|
|
||||||
// Check the number of items in the inventory. It should not have exceeded the allowed maximum
|
// Check the number of items in the inventory. It should not have exceeded the allowed maximum
|
||||||
final List<Item> items = inventory.getItems();
|
final List<Item> items = inventory.getItems();
|
||||||
assertNotNull(items);
|
assertNotNull(items);
|
||||||
assertEquals(INVENTORY_SIZE, items.size());
|
assertEquals(INVENTORY_SIZE, items.size());
|
||||||
|
|
||||||
assertEquals(INVENTORY_SIZE, appender.getLogSize());
|
assertEquals(INVENTORY_SIZE, appender.getLogSize());
|
||||||
|
|
||||||
// ... and check if the inventory size is increasing continuously
|
// ... and check if the inventory size is increasing continuously
|
||||||
for (int i = 0; i < items.size(); i++) {
|
for (int i = 0; i < items.size(); i++) {
|
||||||
assertTrue(appender.log.get(i).getFormattedMessage().contains("items.size()=" + (i + 1)));
|
assertTrue(appender.log.get(i).getFormattedMessage().contains("items.size()=" + (i + 1)));
|
||||||
}
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -34,8 +34,13 @@
|
|||||||
<artifactId>double-dispatch</artifactId>
|
<artifactId>double-dispatch</artifactId>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>org.junit.jupiter</groupId>
|
||||||
<artifactId>junit</artifactId>
|
<artifactId>junit-jupiter-api</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.junit.jupiter</groupId>
|
||||||
|
<artifactId>junit-jupiter-engine</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
*/
|
*/
|
||||||
package com.iluwatar.doubledispatch;
|
package com.iluwatar.doubledispatch;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -22,10 +22,10 @@
|
|||||||
*/
|
*/
|
||||||
package com.iluwatar.doubledispatch;
|
package com.iluwatar.doubledispatch;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
|
||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Date: 12/10/15 - 8:37 PM
|
* Date: 12/10/15 - 8:37 PM
|
||||||
* Test for Collision
|
* Test for Collision
|
||||||
@ -86,7 +86,7 @@ public abstract class CollisionTest<O extends GameObject> {
|
|||||||
? "Expected [" + targetName + "] to be on fire after colliding with [" + otherName + "] but it was not!"
|
? "Expected [" + targetName + "] to be on fire after colliding with [" + otherName + "] but it was not!"
|
||||||
: "Expected [" + targetName + "] not to be on fire after colliding with [" + otherName + "] but it was!";
|
: "Expected [" + targetName + "] not to be on fire after colliding with [" + otherName + "] but it was!";
|
||||||
|
|
||||||
assertEquals(errorMessage, expectTargetOnFire, target.isOnFire());
|
assertEquals(expectTargetOnFire, target.isOnFire(), errorMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -105,7 +105,7 @@ public abstract class CollisionTest<O extends GameObject> {
|
|||||||
? "Expected [" + targetName + "] to be damaged after colliding with [" + otherName + "] but it was not!"
|
? "Expected [" + targetName + "] to be damaged after colliding with [" + otherName + "] but it was not!"
|
||||||
: "Expected [" + targetName + "] not to be damaged after colliding with [" + otherName + "] but it was!";
|
: "Expected [" + targetName + "] not to be damaged after colliding with [" + otherName + "] but it was!";
|
||||||
|
|
||||||
assertEquals(errorMessage, expectedDamage, target.isDamaged());
|
assertEquals(expectedDamage, target.isDamaged(), errorMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -22,11 +22,11 @@
|
|||||||
*/
|
*/
|
||||||
package com.iluwatar.doubledispatch;
|
package com.iluwatar.doubledispatch;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import static org.junit.Assert.assertFalse;
|
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Date: 12/10/15 - 11:31 PM
|
* Date: 12/10/15 - 11:31 PM
|
||||||
|
@ -22,10 +22,10 @@
|
|||||||
*/
|
*/
|
||||||
package com.iluwatar.doubledispatch;
|
package com.iluwatar.doubledispatch;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import static org.junit.Assert.assertFalse;
|
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Date: 12/10/15 - 11:31 PM
|
* Date: 12/10/15 - 11:31 PM
|
||||||
|
@ -22,11 +22,11 @@
|
|||||||
*/
|
*/
|
||||||
package com.iluwatar.doubledispatch;
|
package com.iluwatar.doubledispatch;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import static junit.framework.TestCase.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import static org.junit.Assert.assertFalse;
|
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unit test for Rectangle
|
* Unit test for Rectangle
|
||||||
|
@ -22,10 +22,10 @@
|
|||||||
*/
|
*/
|
||||||
package com.iluwatar.doubledispatch;
|
package com.iluwatar.doubledispatch;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import static org.junit.Assert.assertFalse;
|
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Date: 12/10/15 - 11:31 PM
|
* Date: 12/10/15 - 11:31 PM
|
||||||
|
@ -22,10 +22,10 @@
|
|||||||
*/
|
*/
|
||||||
package com.iluwatar.doubledispatch;
|
package com.iluwatar.doubledispatch;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import static org.junit.Assert.assertFalse;
|
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Date: 12/10/15 - 11:31 PM
|
* Date: 12/10/15 - 11:31 PM
|
||||||
|
@ -48,6 +48,21 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- Testing -->
|
<!-- Testing -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.sbrannen</groupId>
|
||||||
|
<artifactId>spring-test-junit5</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<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>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-test</artifactId>
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user