forked from saemundur-haraldsson/CSCU9T4Practical1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEntryTest.java
148 lines (131 loc) · 3.77 KB
/
EntryTest.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.stir.cscu9t4practical1;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
/**
*
* @author saemundur
*/
public class EntryTest {
public EntryTest() {
}
@BeforeAll
public static void setUpClass() {
}
@AfterAll
public static void tearDownClass() {
}
@BeforeEach
public void setUp() {
}
@AfterEach
public void tearDown() {
}
/**
* Test of getName method, of class Entry.
*/
@Test
public void testGetName() {
System.out.println("getName");
Entry instance = new Entry("Alice", 1, 2, 2003, 0, 16, 7, 3);
String expResult = "Alice";
String result = instance.getName();
assertEquals(expResult, result);
}
/**
* Test of getDay method, of class Entry.
*/
@Test
public void testGetDay() {
System.out.println("getDay");
Entry instance = new Entry("Alice", 1, 2, 2003, 0, 16, 7, 3);
int expResult = 1;
int result = instance.getDay();
assertEquals(expResult, result);
}
/**
* Test of getMonth method, of class Entry.
*/
@Test
public void testGetMonth() {
System.out.println("getMonth");
Entry instance = new Entry("Alice", 1, 2, 2003, 0, 16, 7, 3);
int expResult = 2;
int result = instance.getMonth();
assertEquals(expResult, result);
}
/**
* Test of getYear method, of class Entry.
*/
@Test
public void testGetYear() {
System.out.println("getYear");
Entry instance = new Entry("Alice", 1, 2, 2003, 0, 16, 7, 3);
int expResult = 2003;
int result = instance.getYear();
assertEquals(expResult, result);
}
/**
* Test of getHour method, of class Entry.
*/
@Test
public void testGetHour() {
System.out.println("getHour");
Entry instance = new Entry("Alice", 1, 2, 2003, 0, 16, 7, 3);
int expResult = 0;
int result = instance.getHour();
assertEquals(expResult, result);
}
/**
* Test of getMin method, of class Entry.
*/
@Test
public void testGetMin() {
System.out.println("getMin");
Entry instance = new Entry("Alice", 1, 2, 2003, 0, 16, 7, 3);
int expResult = 16;
int result = instance.getMin();
assertEquals(expResult, result);
}
/**
* Test of getSec method, of class Entry.
*/
@Test
public void testGetSec() {
System.out.println("getSec");
Entry instance = new Entry("Alice", 1, 2, 2003, 0, 16, 7, 3);
int expResult = 7;
int result = instance.getSec();
assertEquals(expResult, result);
}
/**
* Test of getDistance method, of class Entry.
*/
@Test
public void testGetDistance() {
System.out.println("getDistance");
Entry instance = new Entry("Alice", 1, 2, 2003, 0, 16, 7, 3);
float expResult = 3.0F;
float result = instance.getDistance();
assertEquals(expResult, result, 0.0);
}
/**
* Test of getEntry method, of class Entry.
*/
@Test
public void testGetEntry() {
System.out.println("getEntry");
Entry instance = new Entry("Alice", 1, 2, 2003, 0, 16, 7, 3);
String expResult = "Alice ran 3.0 km in 0:16:7 on 1/2/2003\n";
String result = instance.getEntry();
assertEquals(expResult, result);
}
}