KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > mockobjects > examples > password > MockPasswordReminder


1 package com.mockobjects.examples.password;
2
3 import com.mockobjects.ExpectationValue;
4 import com.mockobjects.MockObject;
5
6 public class MockPasswordReminder extends MockObject implements PasswordReminder {
7     private ExpectationValue emailAddress = new ExpectationValue("MockPasswordReminder email");
8     private boolean emailNotFound = false;
9
10     public void sendReminder(String JavaDoc anEmailAddress) throws NotFoundException {
11         emailAddress.setActual(anEmailAddress);
12         if (emailNotFound) {
13             throw new NotFoundException("Not found: " + anEmailAddress);
14         }
15     }
16
17     public void setExpectedEmailAddress(String JavaDoc anEmailAddress) {
18         emailAddress.setExpected(anEmailAddress);
19     }
20
21     public void setupEmailNotFound() {
22         emailNotFound = true;
23     }
24 }
25
Popular Tags