Migrate to JUnit5
This commit is contained in:
@ -22,7 +22,7 @@
|
||||
*/
|
||||
package com.iluwatar.layers;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -22,10 +22,10 @@
|
||||
*/
|
||||
package com.iluwatar.layers;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||
|
||||
/**
|
||||
* Date: 12/15/15 - 7:57 PM
|
||||
|
@ -22,16 +22,17 @@
|
||||
*/
|
||||
package com.iluwatar.layers;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
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.assertThrows;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
/**
|
||||
* Date: 12/15/15 - 9:55 PM
|
||||
@ -123,7 +124,7 @@ public class CakeBakingServiceImplTest {
|
||||
|
||||
}
|
||||
|
||||
@Test(expected = CakeBakingException.class)
|
||||
@Test
|
||||
public void testBakeCakeMissingTopping() throws CakeBakingException {
|
||||
final CakeBakingServiceImpl service = new CakeBakingServiceImpl();
|
||||
|
||||
@ -133,10 +134,12 @@ public class CakeBakingServiceImplTest {
|
||||
service.saveNewLayer(layer2);
|
||||
|
||||
final CakeToppingInfo missingTopping = new CakeToppingInfo("Topping1", 1000);
|
||||
service.bakeNewCake(new CakeInfo(missingTopping, Arrays.asList(layer1, layer2)));
|
||||
assertThrows(CakeBakingException.class, () -> {
|
||||
service.bakeNewCake(new CakeInfo(missingTopping, Arrays.asList(layer1, layer2)));
|
||||
});
|
||||
}
|
||||
|
||||
@Test(expected = CakeBakingException.class)
|
||||
@Test
|
||||
public void testBakeCakeMissingLayer() throws CakeBakingException {
|
||||
final CakeBakingServiceImpl service = new CakeBakingServiceImpl();
|
||||
|
||||
@ -151,11 +154,12 @@ public class CakeBakingServiceImplTest {
|
||||
service.saveNewLayer(layer1);
|
||||
|
||||
final CakeLayerInfo missingLayer = new CakeLayerInfo("Layer2", 2000);
|
||||
service.bakeNewCake(new CakeInfo(topping1, Arrays.asList(layer1, missingLayer)));
|
||||
|
||||
assertThrows(CakeBakingException.class, () -> {
|
||||
service.bakeNewCake(new CakeInfo(topping1, Arrays.asList(layer1, missingLayer)));
|
||||
});
|
||||
}
|
||||
|
||||
@Test(expected = CakeBakingException.class)
|
||||
@Test
|
||||
public void testBakeCakesUsedLayer() throws CakeBakingException {
|
||||
final CakeBakingServiceImpl service = new CakeBakingServiceImpl();
|
||||
|
||||
@ -174,8 +178,9 @@ public class CakeBakingServiceImplTest {
|
||||
service.saveNewLayer(layer2);
|
||||
|
||||
service.bakeNewCake(new CakeInfo(topping1, Arrays.asList(layer1, layer2)));
|
||||
service.bakeNewCake(new CakeInfo(topping2, Collections.singletonList(layer2)));
|
||||
|
||||
assertThrows(CakeBakingException.class, () -> {
|
||||
service.bakeNewCake(new CakeInfo(topping2, Collections.singletonList(layer2)));
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -22,15 +22,15 @@
|
||||
*/
|
||||
package com.iluwatar.layers;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
/**
|
||||
* Date: 12/15/15 - 8:02 PM
|
||||
|
@ -25,17 +25,18 @@ package com.iluwatar.layers;
|
||||
import ch.qos.logback.classic.Logger;
|
||||
import ch.qos.logback.classic.spi.ILoggingEvent;
|
||||
import ch.qos.logback.core.AppenderBase;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
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.ArrayList;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.mockito.Mockito.*;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
/**
|
||||
* Date: 12/15/15 - 10:04 PM
|
||||
@ -46,12 +47,12 @@ public class CakeViewImplTest {
|
||||
|
||||
private InMemoryAppender appender;
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setUp() {
|
||||
appender = new InMemoryAppender(CakeViewImpl.class);
|
||||
}
|
||||
|
||||
@After
|
||||
@AfterEach
|
||||
public void tearDown() {
|
||||
appender.stop();
|
||||
}
|
||||
|
Reference in New Issue
Block a user