mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-08-05 18:24:34 +00:00
docs: update mediator
This commit is contained in:
@@ -24,6 +24,8 @@
|
||||
*/
|
||||
package com.iluwatar.mediator;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* Action enumeration.
|
||||
*/
|
||||
@@ -35,6 +37,7 @@ public enum Action {
|
||||
NONE("", "");
|
||||
|
||||
private final String title;
|
||||
@Getter
|
||||
private final String description;
|
||||
|
||||
Action(String title, String description) {
|
||||
@@ -42,10 +45,6 @@ public enum Action {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return title;
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ class PartyMemberTest {
|
||||
|
||||
for (final var action : Action.values()) {
|
||||
member.partyAction(action);
|
||||
assertEquals(member.toString() + " " + action.getDescription(), appender.getLastMessage());
|
||||
assertEquals(member + " " + action.getDescription(), appender.getLastMessage());
|
||||
}
|
||||
|
||||
assertEquals(Action.values().length, appender.getLogSize());
|
||||
@@ -99,11 +99,11 @@ class PartyMemberTest {
|
||||
|
||||
final var party = mock(Party.class);
|
||||
member.joinedParty(party);
|
||||
assertEquals(member.toString() + " joins the party", appender.getLastMessage());
|
||||
assertEquals(member + " joins the party", appender.getLastMessage());
|
||||
|
||||
for (final var action : Action.values()) {
|
||||
member.act(action);
|
||||
assertEquals(member.toString() + " " + action.toString(), appender.getLastMessage());
|
||||
assertEquals(member + " " + action.toString(), appender.getLastMessage());
|
||||
verify(party).act(member, action);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user