Ben Blinebury 6 lat temu
rodzic
commit
ff7f7b5013
4 zmienionych plików z 123 dodań i 15 usunięć
  1. 3
    1
      README.TXT
  2. 55
    0
      StaffTest.java
  3. 33
    0
      Teacher.java
  4. 32
    14
      package.bluej

+ 3
- 1
README.TXT Wyświetl plik

@@ -10,4 +10,6 @@ except for the addition of an "Address" class and an address attribute
10 10
 in Person.
11 11
 
12 12
 This project may be used to study object creation and method calls from
13
-within other object (non-interactive).
13
+within other object (non-inter	
14
+
15
+Ben Blinebury

+ 55
- 0
StaffTest.java Wyświetl plik

@@ -0,0 +1,55 @@
1
+
2
+
3
+import static org.junit.Assert.*;
4
+import org.junit.After;
5
+import org.junit.Before;
6
+import org.junit.Test;
7
+
8
+/**
9
+ * The test class StaffTest.
10
+ *
11
+ * @author  (your name)
12
+ * @version (a version number or a date)
13
+ */
14
+public class StaffTest
15
+{
16
+    /**
17
+     * Default constructor for test class StaffTest
18
+     */
19
+    public StaffTest()
20
+    {
21
+    }
22
+
23
+    /**
24
+     * Sets up the test fixture.
25
+     *
26
+     * Called before every test case method.
27
+     */
28
+    @Before
29
+    public void setUp()
30
+    {
31
+    }
32
+
33
+    /**
34
+     * Tears down the test fixture.
35
+     *
36
+     * Called after every test case method.
37
+     */
38
+    @After
39
+    public void tearDown()
40
+    {
41
+    }
42
+
43
+    @Test
44
+    public void test1()
45
+    {
46
+        Staff staff3 = new Staff("Kris", 1999, "123");
47
+        assertEquals(test "123", staff3.getRoom());
48
+        assertEquals(, staff3.getRoom());
49
+        assertEquals("re 123'", staff3.getRoom());
50
+        assertEquals("rm 123", staff3.getRoom());
51
+        assertEquals("rm 2b", staff3.getRoom());
52
+        assertEquals("rm 123", staff3.getRoom());
53
+    }
54
+}
55
+

+ 33
- 0
Teacher.java Wyświetl plik

@@ -0,0 +1,33 @@
1
+
2
+/**
3
+ * Write a description of class Teacher here.
4
+ *
5
+ * @author (your name)
6
+ * @version (a version number or a date)
7
+ */
8
+public class Teacher extends Person
9
+{
10
+    // instance variables - replace the example below with your own
11
+    private int x;
12
+
13
+    /**
14
+     * Constructor for objects of class Teacher
15
+     */
16
+    public Teacher()
17
+    {
18
+        // initialise instance variables
19
+        x = 0;
20
+    }
21
+
22
+    /**
23
+     * An example of a method - replace this comment with your own
24
+     *
25
+     * @param  y  a sample parameter for a method
26
+     * @return    the sum of x and y
27
+     */
28
+    public int sampleMethod(int y)
29
+    {
30
+        // put your code here
31
+        return x + y;
32
+    }
33
+}

+ 32
- 14
package.bluej Wyświetl plik

@@ -5,22 +5,25 @@ dependency1.type=UsesDependency
5 5
 dependency2.from=Person
6 6
 dependency2.to=Address
7 7
 dependency2.type=UsesDependency
8
+dependency3.from=StaffTest
9
+dependency3.to=Staff
10
+dependency3.type=UsesDependency
8 11
 editor.fx.0.height=722
9 12
 editor.fx.0.width=800
10
-editor.fx.0.x=2941
11
-editor.fx.0.y=59
13
+editor.fx.0.x=640
14
+editor.fx.0.y=48
12 15
 objectbench.height=106
13
-objectbench.width=461
16
+objectbench.width=776
14 17
 package.divider.horizontal=0.6
15 18
 package.divider.vertical=0.7915129151291513
16 19
 package.editor.height=422
17 20
 package.editor.width=674
18
-package.editor.x=2110
19
-package.editor.y=77
21
+package.editor.x=100
22
+package.editor.y=100
20 23
 package.frame.height=600
21 24
 package.frame.width=800
22
-package.numDependencies=2
23
-package.numTargets=5
25
+package.numDependencies=3
26
+package.numTargets=7
24 27
 package.showExtends=true
25 28
 package.showUses=true
26 29
 project.charset=UTF-8
@@ -36,6 +39,7 @@ target1.type=ClassTarget
36 39
 target1.width=80
37 40
 target1.x=300
38 41
 target1.y=20
42
+target2.association=StaffTest
39 43
 target2.height=50
40 44
 target2.name=Staff
41 45
 target2.showInterface=false
@@ -51,16 +55,30 @@ target3.width=80
51 55
 target3.x=90
52 56
 target3.y=40
53 57
 target4.height=50
54
-target4.name=Student
58
+target4.name=Teacher
55 59
 target4.showInterface=false
56 60
 target4.type=ClassTarget
57 61
 target4.width=80
58
-target4.x=260
59
-target4.y=220
62
+target4.x=390
63
+target4.y=170
60 64
 target5.height=50
61
-target5.name=Person
65
+target5.name=StaffTest
62 66
 target5.showInterface=false
63
-target5.type=AbstractTarget
67
+target5.type=UnitTestTargetJunit4
64 68
 target5.width=80
65
-target5.x=190
66
-target5.y=110
69
+target5.x=160
70
+target5.y=190
71
+target6.height=50
72
+target6.name=Student
73
+target6.showInterface=false
74
+target6.type=ClassTarget
75
+target6.width=80
76
+target6.x=260
77
+target6.y=220
78
+target7.height=50
79
+target7.name=Person
80
+target7.showInterface=false
81
+target7.type=AbstractTarget
82
+target7.width=80
83
+target7.x=190
84
+target7.y=110