mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-10-06 06:16:05 +00:00
#113 Event Driven Architecture
Adds unit test to assert and verify pattern behaviour
This commit is contained in:
1 parent
e1c0731f7e
commit
3ad36020aa
4 files changed
+61
-2
No files matched your search
@@ -39,4 +39,12 @@ public class EventDispatcher implements DynamicRouter<Event> {
|
||||
public void dispatch(Event content) {
|
||||
handlers.get(content.getClass()).dispatch(content);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a map of registered event handlers.
|
||||
* @return {@Map} of registered event handlers.
|
||||
*/
|
||||
public Map<Class<? extends Event>, Channel<?>> getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
@@ -15,7 +15,6 @@ public class UserCreatedEvent extends Event {
|
||||
this.user = user;
|
||||
}
|
||||
|
||||
|
||||
public User getUser() {
|
||||
return user;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user