Merge pull request 'Make Unit Tests Executable by Maven' (#29) from b/unit-test-execution into develop

Reviewed-on: https://git.kske.dev/kske/event-bus/pulls/29
Reviewed-by: delvh <leon@kske.dev>
This commit is contained in:
Kai S. K. Engelbart 2021-11-25 12:04:26 +01:00
commit 85b2da391a
Signed by: Käfer & Engelbart Git
GPG Key ID: 70F2F9206EDC1FCE
6 changed files with 31 additions and 22 deletions

View File

@ -16,7 +16,7 @@
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.6.2</version>
<version>5.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
@ -26,5 +26,14 @@
<!-- Disable resource folder -->
<resources />
<!-- Run unit tests -->
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M5</version>
</plugin>
</plugins>
</build>
</project>

View File

@ -11,7 +11,7 @@ import org.junit.jupiter.api.*;
* @author Leon Hofmeister
* @since 0.1.0
*/
class CancelTest {
public class CancelTest {
EventBus bus;
int hits;
@ -22,7 +22,7 @@ class CancelTest {
* @since 0.1.0
*/
@BeforeEach
void registerListener() {
public void registerListener() {
bus = new EventBus();
bus.registerListener(this);
}
@ -34,7 +34,7 @@ class CancelTest {
* @since 0.1.0
*/
@Test
void testCancellation() {
public void testCancellation() {
bus.dispatch(new SimpleEvent());
assertEquals(1, hits);
}

View File

@ -10,7 +10,7 @@ import org.junit.jupiter.api.Test;
* @author Kai S. K. Engelbart
* @since 1.1.0
*/
class DeadTest {
public class DeadTest {
EventBus bus = new EventBus();
String event = "This event has no handler";
@ -22,7 +22,7 @@ class DeadTest {
* @since 1.1.0
*/
@Test
void testDeadEvent() {
public void testDeadEvent() {
bus.registerListener(this);
bus.dispatch(event);
assertTrue(deadEventHandled);
@ -36,7 +36,7 @@ class DeadTest {
* @since 1.1.0
*/
@Test
void testUnhandledDeadEvent() {
public void testUnhandledDeadEvent() {
bus.dispatch(event);
}

View File

@ -12,7 +12,7 @@ import org.junit.jupiter.api.*;
*/
@Polymorphic
@Priority(150)
class DispatchTest {
public class DispatchTest {
EventBus bus;
static int hits;
@ -23,7 +23,7 @@ class DispatchTest {
* @since 0.0.1
*/
@BeforeEach
void registerListener() {
public void registerListener() {
bus = new EventBus();
bus.registerListener(this);
bus.registerListener(SimpleEvent.class, e -> {
@ -39,7 +39,7 @@ class DispatchTest {
* @since 0.0.1
*/
@Test
void testDispatch() {
public void testDispatch() {
bus.dispatch(new SimpleEventSub());
bus.dispatch(new SimpleEvent());
}
@ -50,7 +50,7 @@ class DispatchTest {
* @since 1.2.0
*/
@Test
void testPrintExecutionOrder() {
public void testPrintExecutionOrder() {
String executionOrder = bus.printExecutionOrder(SimpleEvent.class);
System.out.println(executionOrder);
assertEquals(

View File

@ -10,7 +10,7 @@ import org.junit.jupiter.api.Test;
* @author Kai S. K. Engelbart
* @since 1.1.0
*/
class ExceptionTest {
public class ExceptionTest {
EventBus bus = new EventBus();
String event = "This event will cause an exception";
@ -23,7 +23,7 @@ class ExceptionTest {
* @since 1.1.0
*/
@Test
void testExceptionEvent() {
public void testExceptionEvent() {
bus.registerListener(this);
bus.registerListener(new ExceptionListener());
bus.dispatch(event);
@ -38,7 +38,7 @@ class ExceptionTest {
* @since 1.1.0
*/
@Test
void testUnhandledExceptionEvent() {
public void testUnhandledExceptionEvent() {
bus.registerListener(this);
bus.dispatch(event);
bus.removeListener(this);

View File

@ -10,7 +10,7 @@ import org.junit.jupiter.api.*;
* @author Kai S. K. Engelbart
* @since 1.2.0
*/
class NestedTest {
public class NestedTest {
EventBus bus;
boolean nestedHit;
@ -21,7 +21,7 @@ class NestedTest {
* @since 1.2.0
*/
@BeforeEach
void registerListener() {
public void registerListener() {
bus = new EventBus();
bus.registerListener(this);
}
@ -34,7 +34,7 @@ class NestedTest {
* @since 1.2.0
*/
@Test
void testNestedDispatch() {
public void testNestedDispatch() {
bus.dispatch(new SimpleEvent());
assertTrue(nestedHit);
}