2829303132333435363738
} public void testClosedUnlock() { Door door = new Door(); try { door.unlock(); fail("expected exception"); } catch (IllegalStateException e) { } }
6263646566676869707172
public void testOpenedUnlock() { Door door = new Door(); door.state = Door.OPEN; try { door.unlock(); fail("expected exception"); } catch (IllegalStateException e) { } }
101102103104105106107108109110111
} public void testLockedUnlock() { Door door = new Door(); door.state = Door.LOCKED; door.unlock(); assertSame(Door.CLOSED, door.state); } public void testOpenLockedOpen() { Door door = new Door();
138139140141142143144145146
} public void testOpenLockedUnlock() { Door door = new Door(); door.state = Door.OPEN_LOCKED; door.unlock(); assertSame(Door.OPEN, door.state); } }