Migrate to JUnit5
This commit is contained in:
@ -22,7 +22,7 @@
|
||||
*/
|
||||
package com.iluwatar.poison.pill;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -25,16 +25,16 @@ package com.iluwatar.poison.pill;
|
||||
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.time.LocalDateTime;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
/**
|
||||
* Date: 12/27/15 - 9:45 PM
|
||||
@ -45,12 +45,12 @@ public class ConsumerTest {
|
||||
|
||||
private InMemoryAppender appender;
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setUp() {
|
||||
appender = new InMemoryAppender(Consumer.class);
|
||||
}
|
||||
|
||||
@After
|
||||
@AfterEach
|
||||
public void tearDown() {
|
||||
appender.stop();
|
||||
}
|
||||
|
@ -22,10 +22,11 @@
|
||||
*/
|
||||
package com.iluwatar.poison.pill;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static com.iluwatar.poison.pill.Message.Headers;
|
||||
import static com.iluwatar.poison.pill.Message.POISON_PILL;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
|
||||
/**
|
||||
* Date: 12/27/15 - 10:30 PM
|
||||
@ -34,29 +35,39 @@ import static com.iluwatar.poison.pill.Message.POISON_PILL;
|
||||
*/
|
||||
public class PoisonMessageTest {
|
||||
|
||||
@Test(expected = UnsupportedOperationException.class)
|
||||
@Test
|
||||
public void testAddHeader() throws Exception {
|
||||
POISON_PILL.addHeader(Headers.SENDER, "sender");
|
||||
assertThrows(UnsupportedOperationException.class, () -> {
|
||||
POISON_PILL.addHeader(Headers.SENDER, "sender");
|
||||
});
|
||||
}
|
||||
|
||||
@Test(expected = UnsupportedOperationException.class)
|
||||
@Test
|
||||
public void testGetHeader() throws Exception {
|
||||
POISON_PILL.getHeader(Headers.SENDER);
|
||||
assertThrows(UnsupportedOperationException.class, () -> {
|
||||
POISON_PILL.getHeader(Headers.SENDER);
|
||||
});
|
||||
}
|
||||
|
||||
@Test(expected = UnsupportedOperationException.class)
|
||||
@Test
|
||||
public void testGetHeaders() throws Exception {
|
||||
POISON_PILL.getHeaders();
|
||||
assertThrows(UnsupportedOperationException.class, () -> {
|
||||
POISON_PILL.getHeaders();
|
||||
});
|
||||
}
|
||||
|
||||
@Test(expected = UnsupportedOperationException.class)
|
||||
@Test
|
||||
public void testSetBody() throws Exception {
|
||||
POISON_PILL.setBody("Test message.");
|
||||
assertThrows(UnsupportedOperationException.class, () -> {
|
||||
POISON_PILL.setBody("Test message.");
|
||||
});
|
||||
}
|
||||
|
||||
@Test(expected = UnsupportedOperationException.class)
|
||||
@Test
|
||||
public void testGetBody() throws Exception {
|
||||
POISON_PILL.getBody();
|
||||
assertThrows(UnsupportedOperationException.class, () -> {
|
||||
POISON_PILL.getBody();
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -22,12 +22,12 @@
|
||||
*/
|
||||
package com.iluwatar.poison.pill;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.mockito.ArgumentCaptor;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.fail;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
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.verify;
|
||||
|
@ -22,14 +22,15 @@
|
||||
*/
|
||||
package com.iluwatar.poison.pill;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
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/27/15 - 10:25 PM
|
||||
@ -51,11 +52,13 @@ public class SimpleMessageTest {
|
||||
assertEquals(senderName, message.getHeaders().get(Message.Headers.SENDER));
|
||||
}
|
||||
|
||||
@Test(expected = UnsupportedOperationException.class)
|
||||
@Test
|
||||
public void testUnModifiableHeaders() {
|
||||
final SimpleMessage message = new SimpleMessage();
|
||||
final Map<Message.Headers, String> headers = message.getHeaders();
|
||||
headers.put(Message.Headers.SENDER, "test");
|
||||
assertThrows(UnsupportedOperationException.class, () -> {
|
||||
headers.put(Message.Headers.SENDER, "test");
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user