262728293031323334353637
} catch (IllegalStateException e) { } } public void testClosedUnlock() { Door door = new Door(); try { door.unlock(); fail("expected exception"); } catch (IllegalStateException e) { } }
35363738394041424344454647
} catch (IllegalStateException e) { } } public void testOpenedOpen() { Door door = new Door(); door.state = Door.OPEN; try { door.open(); fail("expected exception"); } catch (IllegalStateException e) { } }
45464748495051525354
} catch (IllegalStateException e) { } } public void testOpenedLock() { Door door = new Door(); door.state = Door.OPEN; door.lock(); assertSame(Door.OPEN_LOCKED, door.state); }
52535455565758596061
door.lock(); assertSame(Door.OPEN_LOCKED, door.state); } public void testOpenedClose() { Door door = new Door(); door.state = Door.OPEN; door.close(); assertSame(Door.CLOSED, door.state); }
59606162636465666768697071
door.close(); assertSame(Door.CLOSED, door.state); } public void testOpenedUnlock() { Door door = new Door(); door.state = Door.OPEN; try { door.unlock(); fail("expected exception"); } catch (IllegalStateException e) { } }
69707172737475767778798081
} catch (IllegalStateException e) { } } public void testLockedOpen() { Door door = new Door(); door.state = Door.LOCKED; try { door.open(); fail("expected exception"); } catch (IllegalStateException e) { } }
79808182838485868788899091
} catch (IllegalStateException e) { } } public void testLockedLock() { Door door = new Door(); door.state = Door.LOCKED; try { door.lock(); fail("expected exception"); } catch (IllegalStateException e) { } }
8990919293949596979899100101
} catch (IllegalStateException e) { } } public void testLockedClose() { Door door = new Door(); door.state = Door.LOCKED; try { door.close(); fail("expected exception"); } catch (IllegalStateException e) { } }
99100101102103104105106107108
} catch (IllegalStateException e) { } } public void testLockedUnlock() { Door door = new Door(); door.state = Door.LOCKED; door.unlock(); assertSame(Door.CLOSED, door.state); }
106107108109110111112113114115116117118
door.unlock(); assertSame(Door.CLOSED, door.state); } public void testOpenLockedOpen() { Door door = new Door(); door.state = Door.OPEN_LOCKED; try { door.open(); fail("expected exception"); } catch (IllegalStateException e) { } }