MasterLockTest

MasterLockTest - */ public void testOpeningWrongCombo() {...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
import junit.framework.TestCase; i /** * Test the MasterLock class. * Brandy Hicks, Allysa Ault, 2005-10-13 */ public class MasterLockTest extends TestCase { private MasterLock lock; public void setUp(){ lock = new MasterLock(7, 3, 1); } /** * Test the isOpen() query. */ public void testIsOpen() { assertFalse(lock.toString(), lock.isOpen()); } /** * Test opening the lock with the correct combination. */ public void testOpeningRightCombo() { lock.enter(7); lock.enter(3); lock.enter(1); assertTrue(lock.isOpen()); } /** * Test opening the lock with the wrong combination.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: */ public void testOpeningWrongCombo() { lock.enter(7); lock.enter(28); lock.enter(1); assertFalse(lock.toString(), lock.isOpen()); } /** * Test opening the lock with the right combination * entered in the wrong order. */ public void testOpeningWrongCombo1() { lock.enter(3); lock.enter(7); lock.enter(1); assertFalse(lock.isOpen()); } /** * Test closing the lock. */ public void testClose() { lock.enter(7); lock.enter(3); lock.enter(1); lock.close(); assertFalse(lock.isOpen()); } }...
View Full Document

This document was uploaded on 10/23/2009.

Page1 / 2

MasterLockTest - */ public void testOpeningWrongCombo() {...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online