Migrate to JUnit5
This commit is contained in:
@ -34,8 +34,13 @@
|
||||
<artifactId>event-asynchronous</artifactId>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter-api</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter-engine</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
@ -16,9 +16,9 @@
|
||||
*/
|
||||
package com.iluwatar.event.asynchronous;
|
||||
|
||||
import java.io.IOException;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.junit.Test;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* Tests that EventAsynchronous example runs without errors.
|
||||
|
@ -16,12 +16,13 @@
|
||||
*/
|
||||
package com.iluwatar.event.asynchronous;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -33,7 +34,7 @@ public class EventAsynchronousTest {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(EventAsynchronousTest.class);
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setUp() {
|
||||
app = new App();
|
||||
}
|
||||
@ -71,17 +72,19 @@ public class EventAsynchronousTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test(expected = InvalidOperationException.class)
|
||||
@Test
|
||||
public void testUnsuccessfulSynchronousEvent() throws InvalidOperationException {
|
||||
EventManager eventManager = new EventManager();
|
||||
try {
|
||||
int sEventId = eventManager.create(60);
|
||||
eventManager.start(sEventId);
|
||||
sEventId = eventManager.create(60);
|
||||
eventManager.start(sEventId);
|
||||
} catch (MaxNumOfEventsAllowedException | LongRunningEventException | EventDoesNotExistException e) {
|
||||
LOGGER.error(e.getMessage());
|
||||
}
|
||||
assertThrows(InvalidOperationException.class, () -> {
|
||||
EventManager eventManager = new EventManager();
|
||||
try {
|
||||
int sEventId = eventManager.create(60);
|
||||
eventManager.start(sEventId);
|
||||
sEventId = eventManager.create(60);
|
||||
eventManager.start(sEventId);
|
||||
} catch (MaxNumOfEventsAllowedException | LongRunningEventException | EventDoesNotExistException e) {
|
||||
LOGGER.error(e.getMessage());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
|
Reference in New Issue
Block a user