Document Latest Features in README #27
@ -16,7 +16,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.junit.jupiter</groupId>
|
<groupId>org.junit.jupiter</groupId>
|
||||||
<artifactId>junit-jupiter-api</artifactId>
|
<artifactId>junit-jupiter-api</artifactId>
|
||||||
<version>5.6.2</version>
|
<version>5.8.1</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
@ -26,5 +26,14 @@
|
|||||||
<!-- Disable resource folder -->
|
<!-- Disable resource folder -->
|
||||||
<resources />
|
<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>
|
</build>
|
||||||
</project>
|
</project>
|
@ -11,7 +11,7 @@ import org.junit.jupiter.api.*;
|
|||||||
* @author Leon Hofmeister
|
* @author Leon Hofmeister
|
||||||
* @since 0.1.0
|
* @since 0.1.0
|
||||||
*/
|
*/
|
||||||
class CancelTest {
|
public class CancelTest {
|
||||||
|
|
||||||
EventBus bus;
|
EventBus bus;
|
||||||
int hits;
|
int hits;
|
||||||
@ -22,7 +22,7 @@ class CancelTest {
|
|||||||
* @since 0.1.0
|
* @since 0.1.0
|
||||||
*/
|
*/
|
||||||
@BeforeEach
|
@BeforeEach
|
||||||
void registerListener() {
|
public void registerListener() {
|
||||||
bus = new EventBus();
|
bus = new EventBus();
|
||||||
bus.registerListener(this);
|
bus.registerListener(this);
|
||||||
}
|
}
|
||||||
@ -34,7 +34,7 @@ class CancelTest {
|
|||||||
* @since 0.1.0
|
* @since 0.1.0
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
void testCancellation() {
|
public void testCancellation() {
|
||||||
bus.dispatch(new SimpleEvent());
|
bus.dispatch(new SimpleEvent());
|
||||||
assertEquals(1, hits);
|
assertEquals(1, hits);
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@ import org.junit.jupiter.api.Test;
|
|||||||
* @author Kai S. K. Engelbart
|
* @author Kai S. K. Engelbart
|
||||||
* @since 1.1.0
|
* @since 1.1.0
|
||||||
*/
|
*/
|
||||||
class DeadTest {
|
public class DeadTest {
|
||||||
|
|
||||||
EventBus bus = new EventBus();
|
EventBus bus = new EventBus();
|
||||||
String event = "This event has no handler";
|
String event = "This event has no handler";
|
||||||
@ -18,11 +18,11 @@ class DeadTest {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests dead event delivery.
|
* Tests dead event delivery.
|
||||||
*
|
*
|
||||||
* @since 1.1.0
|
* @since 1.1.0
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
void testDeadEvent() {
|
public void testDeadEvent() {
|
||||||
bus.registerListener(this);
|
bus.registerListener(this);
|
||||||
bus.dispatch(event);
|
bus.dispatch(event);
|
||||||
assertTrue(deadEventHandled);
|
assertTrue(deadEventHandled);
|
||||||
@ -32,11 +32,11 @@ class DeadTest {
|
|||||||
/**
|
/**
|
||||||
* Tests how the event bus reacts to an unhandled dead event. This should not lead to an
|
* Tests how the event bus reacts to an unhandled dead event. This should not lead to an
|
||||||
* exception or an endless recursion and should be logged instead.
|
* exception or an endless recursion and should be logged instead.
|
||||||
*
|
*
|
||||||
* @since 1.1.0
|
* @since 1.1.0
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
void testUnhandledDeadEvent() {
|
public void testUnhandledDeadEvent() {
|
||||||
bus.dispatch(event);
|
bus.dispatch(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ import org.junit.jupiter.api.*;
|
|||||||
*/
|
*/
|
||||||
@Polymorphic
|
@Polymorphic
|
||||||
@Priority(150)
|
@Priority(150)
|
||||||
class DispatchTest {
|
public class DispatchTest {
|
||||||
|
|
||||||
EventBus bus;
|
EventBus bus;
|
||||||
static int hits;
|
static int hits;
|
||||||
@ -23,7 +23,7 @@ class DispatchTest {
|
|||||||
* @since 0.0.1
|
* @since 0.0.1
|
||||||
*/
|
*/
|
||||||
@BeforeEach
|
@BeforeEach
|
||||||
void registerListener() {
|
public void registerListener() {
|
||||||
bus = new EventBus();
|
bus = new EventBus();
|
||||||
bus.registerListener(this);
|
bus.registerListener(this);
|
||||||
bus.registerListener(SimpleEvent.class, e -> {
|
bus.registerListener(SimpleEvent.class, e -> {
|
||||||
@ -39,7 +39,7 @@ class DispatchTest {
|
|||||||
* @since 0.0.1
|
* @since 0.0.1
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
void testDispatch() {
|
public void testDispatch() {
|
||||||
bus.dispatch(new SimpleEventSub());
|
bus.dispatch(new SimpleEventSub());
|
||||||
bus.dispatch(new SimpleEvent());
|
bus.dispatch(new SimpleEvent());
|
||||||
}
|
}
|
||||||
@ -50,7 +50,7 @@ class DispatchTest {
|
|||||||
* @since 1.2.0
|
* @since 1.2.0
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
void testPrintExecutionOrder() {
|
public void testDebugExecutionOrder() {
|
||||||
String executionOrder = bus.debugExecutionOrder(SimpleEvent.class);
|
String executionOrder = bus.debugExecutionOrder(SimpleEvent.class);
|
||||||
System.out.println(executionOrder);
|
System.out.println(executionOrder);
|
||||||
assertEquals(
|
assertEquals(
|
||||||
|
@ -6,11 +6,11 @@ import org.junit.jupiter.api.Test;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests the dispatching of an exception event if an event handler threw an exception.
|
* Tests the dispatching of an exception event if an event handler threw an exception.
|
||||||
*
|
*
|
||||||
* @author Kai S. K. Engelbart
|
* @author Kai S. K. Engelbart
|
||||||
* @since 1.1.0
|
* @since 1.1.0
|
||||||
*/
|
*/
|
||||||
class ExceptionTest {
|
public class ExceptionTest {
|
||||||
|
|
||||||
EventBus bus = new EventBus();
|
EventBus bus = new EventBus();
|
||||||
String event = "This event will cause an exception";
|
String event = "This event will cause an exception";
|
||||||
@ -19,11 +19,11 @@ class ExceptionTest {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests exception event delivery.
|
* Tests exception event delivery.
|
||||||
*
|
*
|
||||||
* @since 1.1.0
|
* @since 1.1.0
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
void testExceptionEvent() {
|
public void testExceptionEvent() {
|
||||||
bus.registerListener(this);
|
bus.registerListener(this);
|
||||||
bus.registerListener(new ExceptionListener());
|
bus.registerListener(new ExceptionListener());
|
||||||
bus.dispatch(event);
|
bus.dispatch(event);
|
||||||
@ -34,11 +34,11 @@ class ExceptionTest {
|
|||||||
/**
|
/**
|
||||||
* Tests how the event bus reacts to an unhandled exception event. This should not lead to an
|
* Tests how the event bus reacts to an unhandled exception event. This should not lead to an
|
||||||
* exception or an endless recursion and should be logged instead.
|
* exception or an endless recursion and should be logged instead.
|
||||||
*
|
*
|
||||||
* @since 1.1.0
|
* @since 1.1.0
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
void testUnhandledExceptionEvent() {
|
public void testUnhandledExceptionEvent() {
|
||||||
bus.registerListener(this);
|
bus.registerListener(this);
|
||||||
bus.dispatch(event);
|
bus.dispatch(event);
|
||||||
bus.removeListener(this);
|
bus.removeListener(this);
|
||||||
|
@ -10,7 +10,7 @@ import org.junit.jupiter.api.*;
|
|||||||
* @author Kai S. K. Engelbart
|
* @author Kai S. K. Engelbart
|
||||||
* @since 1.2.0
|
* @since 1.2.0
|
||||||
*/
|
*/
|
||||||
class NestedTest {
|
public class NestedTest {
|
||||||
|
|
||||||
EventBus bus;
|
EventBus bus;
|
||||||
boolean nestedHit;
|
boolean nestedHit;
|
||||||
@ -21,7 +21,7 @@ class NestedTest {
|
|||||||
* @since 1.2.0
|
* @since 1.2.0
|
||||||
*/
|
*/
|
||||||
@BeforeEach
|
@BeforeEach
|
||||||
void registerListener() {
|
public void registerListener() {
|
||||||
bus = new EventBus();
|
bus = new EventBus();
|
||||||
bus.registerListener(this);
|
bus.registerListener(this);
|
||||||
}
|
}
|
||||||
@ -34,7 +34,7 @@ class NestedTest {
|
|||||||
* @since 1.2.0
|
* @since 1.2.0
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
void testNestedDispatch() {
|
public void testNestedDispatch() {
|
||||||
bus.dispatch(new SimpleEvent());
|
bus.dispatch(new SimpleEvent());
|
||||||
assertTrue(nestedHit);
|
assertTrue(nestedHit);
|
||||||
}
|
}
|
||||||
|
22
pom.xml
22
pom.xml
@ -120,6 +120,28 @@
|
|||||||
</goals>
|
</goals>
|
||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
|
|
||||||
|
<!-- Support JDK-style Javadoc tags -->
|
||||||
|
<configuration>
|
||||||
|
<tags>
|
||||||
|
<tag>
|
||||||
|
<name>apiNote</name>
|
||||||
|
<placement>a</placement>
|
||||||
|
<head>API Note:</head>
|
||||||
|
</tag>
|
||||||
|
<tag>
|
||||||
|
<name>implSpec</name>
|
||||||
|
<placement>a</placement>
|
||||||
|
<head>Implementation Requirements:</head>
|
||||||
|
</tag>
|
||||||
|
<tag>
|
||||||
|
<name>implNote</name>
|
||||||
|
<placement>a</placement>
|
||||||
|
<head>Implementation Note:</head>
|
||||||
|
</tag>
|
||||||
|
</tags>
|
||||||
|
</configuration>
|
||||||
|
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
<!-- GPG sign JAR -->
|
<!-- GPG sign JAR -->
|
||||||
|
Loading…
Reference in New Issue
Block a user