mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-05-16 06:58:54 +00:00
docs: improve lockable object
This commit is contained in:
@@ -90,7 +90,7 @@ class CreatureTest {
|
||||
Assertions.assertEquals(orc, sword.getLocker());
|
||||
}
|
||||
|
||||
void killCreature(Creature source, Creature target) throws InterruptedException {
|
||||
void killCreature(Creature source, Creature target) {
|
||||
while (target.isAlive()) {
|
||||
source.attack(target);
|
||||
}
|
||||
|
||||
@@ -29,17 +29,17 @@ import org.junit.jupiter.api.Test;
|
||||
|
||||
class ExceptionsTest {
|
||||
|
||||
private String msg = "test";
|
||||
private static final String MSG = "test";
|
||||
|
||||
@Test
|
||||
void testException(){
|
||||
Exception e;
|
||||
try{
|
||||
throw new LockingException(msg);
|
||||
throw new LockingException(MSG);
|
||||
}
|
||||
catch(LockingException ex){
|
||||
e = ex;
|
||||
}
|
||||
Assertions.assertEquals(msg, e.getMessage());
|
||||
Assertions.assertEquals(MSG, e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user