You are on page 1of 4

Kevin: Method tested: /** * Blocks a NonProfit. */ public void blockNonProfit() { super.

setMy_accessLevel(-1); } The test: @Before public void setUp() throws Exception { Address address1 = new Address("123 crasy St", "", "B", "Miami", "FL", "33125"); NonProfit nonProfit = new NonProfit("Abdiel", "Cabrera", "WTF", "23431", null, address1, "asdvsf@sgfr.com"); nonProfit.setMy_accessLevel(3); nonProfit.blockNonProfit(); blocked_nonProfit = nonProfit.getMy_accessLevel(); } @Test public void testblockNonProfit() { assertEquals("Block access level", blocked_nonProfit, -1); }

Abdiel: Method tested: /** * Submit Payment. * * @return TRUE if payment Submitted. * FALSE otherwise. */ public boolean submitPayment() { if (super.getMy_accessLevel() == 3) return true; else return false; } The test: @Before public void setUp() throws Exception { Address address1 = new Address("123 crasy St", "", "B", "Miami", "FL", "33125"); NonProfit nonProfit = new NonProfit("Abdiel", "Cabrera", "WTF", "23431", null, address1, "asdvsf@sgfr.com"); nonProfit.setMy_accessLevel(3); nonProfit.blockNonProfit(); blocked_nonProfit = nonProfit.getMy_accessLevel(); } @Test public void testsubmitPayment() { assertTrue("Was the payment submitted?", nonProfit.submitPayment()); }

Bob: Method tested: /** * Cancels the current Auction. */ public void cancelAuction() { my_currentAuction = null; } The test: @Before public void setUp() throws Exception { Address address1 = new Address("123 crasy St", "", "B", "Miami", "FL", "33125"); NonProfit nonProfit = new NonProfit("Abdiel", "Cabrera", "WTF", "23431", null, address1, "asdvsf@sgfr.com"); nonProfit.setMy_accessLevel(3); nonProfit.blockNonProfit(); blocked_nonProfit = nonProfit.getMy_accessLevel(); } @Test public void testcancelAuction(){ // the auction has been cancelled and therefore it is null assertNull(nonProfit.getMy_currentAuction()); }

Eric: Method tested: /** * Checks for a valid User. * * @param the_userName The userName of the User. * @param the_password The password of the User. * @return TRUE if credentials accepted and FALSE otherwise. */ public boolean isValidUser(String the_userName, String the_password) { if (the_userName.equals(this.my_userName) && the_password.equals(my_password)) return true; else return false; } The test: private Bidder user = new Bidder("Abdiel", "Cabrera", "username", "password", null, null, null); @Test public void testisValidUser() { assertTrue("Testing CreditCard1", user.isValidUser("username", "password")); assertFalse("Testing CreditCard2", user.isValidUser("fake", "fake")); }

You might also like