Migrate to JUnit5

This commit is contained in:
Artur Mogozov
2017-12-31 16:29:48 +09:00
parent a20e54d0a7
commit 6694d742a3
408 changed files with 2656 additions and 2165 deletions

View File

@ -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>

View File

@ -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.

View File

@ -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