Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Turn event into an interface, add TestEvent for test
- Loading branch information
Showing
3 changed files
with
13 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
package nl.grum.microcraft; | ||
|
||
public class Event { | ||
public interface Event<L> { | ||
void notify(final L listener); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,25 @@ | ||
package nl.grum.microcraft; | ||
|
||
import static org.hamcrest.CoreMatchers.notNullValue; | ||
import static org.hamcrest.CoreMatchers.is; | ||
import static org.junit.Assert.assertNotNull; | ||
import static org.junit.Assert.assertThat; | ||
|
||
import org.junit.Before; | ||
import org.junit.Test; | ||
|
||
public class EventTest { | ||
|
||
private Event subject; | ||
private static final String STRING = "foo"; | ||
private TestEvent subject; | ||
|
||
@Before | ||
public void setup() { | ||
subject = new Event(); | ||
subject = new TestEvent(STRING); | ||
} | ||
|
||
@Test | ||
public void stupidTest() { | ||
assertThat(subject, notNullValue()); | ||
public void eventHasStringData() { | ||
assertNotNull(subject.getString()); | ||
assertThat(subject.getString(), is(STRING)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters