2 * Oprettet Apr 26, 2005 af tobibobi
6 import drno
.exception
.ConsistanceException
;
7 import drno
.interfaces
.IEmployee
;
8 import drno
.server
.model
.EmployeeImpl
;
9 import junit
.framework
.TestCase
;
14 public class EmployeeTest
extends TestCase
{
16 private EmployeeImpl emp
;
18 * Constructor for EmployeeTest.
21 public EmployeeTest(String arg0
) {
23 emp
= new EmployeeImpl();
26 public final void testSetEfternavn() {
29 fail("zero length should throw drno.exception");
30 } catch (ConsistanceException e
) {
31 // if it throws it was correct.
34 String testval
= "Hansen";
35 emp
.setEfternavn(testval
);
36 assertEquals(emp
.getEfternavn(),testval
);
37 } catch (ConsistanceException e
) {
42 public final void testSetFornavn() {
45 fail("zero length should throw drno.exception");
46 } catch (ConsistanceException e
) {
47 // if it throws it was correct.
50 String testval
= "Hansen";
51 emp
.setFornavn(testval
);
52 assertEquals(emp
.getFornavn(),testval
);
53 } catch (ConsistanceException e
) {
58 public final void testSetLogin() {
61 fail("zero length should throw drno.exception");
62 } catch (ConsistanceException e
) {
63 // if it throws it was correct.
66 String testval
= "Hansen";
67 emp
.setLogin(testval
);
68 assertEquals(emp
.getLogin(),testval
);
69 } catch (ConsistanceException e
) {
74 public final void testSetPassword() {
76 String phrase
= "Alloal";
77 emp
.setPassword(phrase
);
78 assertFalse("The passphrase tester accepts true even if the object is in the database",emp
.verify(phrase
));
81 } catch(ConsistanceException e
) {
87 public final void testSetTelefonNummer() {
89 emp
.setTelefonNummer("1000");
90 fail("wrong format should throw drno.exception");
91 } catch (ConsistanceException e
) {
92 // if it throws it was correct.
95 String testval
= "1212 12 12";
96 emp
.setTelefonNummer(testval
);
97 assertEquals(emp
.getTelefonNummer(),testval
);
98 } catch (ConsistanceException e
) {
103 public final void testSetTidsOpdeling() {
105 emp
.setTidsOpdeling(0);
106 fail("wrong format should throw drno.exception");
107 } catch (ConsistanceException e
) {
108 // if it throws it was correct.
112 emp
.setTidsOpdeling(testval
);
113 assertEquals(emp
.getTidsOpdeling(),testval
);
114 } catch (ConsistanceException e
) {
119 public final void testSetType() {
122 fail("wrong format should throw drno.exception");
123 } catch (ConsistanceException e
) {
124 // if it throws it was correct.
127 int type
= IEmployee
.TYPE_DOCTOR
;
129 assertEquals(emp
.getType(),type
);
131 type
= IEmployee
.TYPE_NURSE
;
133 assertEquals(emp
.getType(),type
);
135 type
= IEmployee
.TYPE_SECRETARY
;
137 assertEquals(emp
.getType(),type
);
138 } catch (ConsistanceException e
) {
141 //TODO Implement setType().