Skip to content

Commit cd5bbf1

Browse files
authored
Merge pull request #2 from AugustineKadima/master
Appdated gradle dependencies
2 parents c21d12f + dc4a224 commit cd5bbf1

File tree

2 files changed

+36
-34
lines changed

2 files changed

+36
-34
lines changed

build.gradle

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,11 @@ repositories {
1515
}
1616

1717
dependencies {
18-
testCompile group: 'junit', name: 'junit', version: '4.12'
19-
compile "com.sparkjava:spark-core:2.6.0"
20-
compile "com.sparkjava:spark-template-handlebars:2.5.5"
21-
compile 'org.slf4j:slf4j-simple:1.7.21'
22-
compile 'org.sql2o:sql2o:1.5.4'
23-
compile group: 'com.h2database', name: 'h2', version: '1.4.191'
18+
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.0'
19+
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.0'
20+
implementation "com.sparkjava:spark-core:2.6.0"
21+
implementation "com.sparkjava:spark-template-handlebars:2.5.5"
22+
implementation 'org.slf4j:slf4j-simple:1.7.21'
23+
implementation 'org.sql2o:sql2o:1.5.4'
24+
implementation group: 'com.h2database', name: 'h2', version: '1.4.191'
2425
}

src/test/java/models/TaskTest.java

Lines changed: 29 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,80 +1,81 @@
11
package models;
22

3-
import org.junit.After;
4-
import org.junit.Before;
5-
import org.junit.Test;
3+
4+
import org.junit.jupiter.api.AfterEach;
5+
import org.junit.jupiter.api.Assertions;
6+
import org.junit.jupiter.api.BeforeEach;
7+
import org.junit.jupiter.api.Test;
68

79
import java.time.LocalDateTime;
810

9-
import static org.junit.Assert.*;
1011

1112
public class TaskTest {
12-
@Before
13+
@BeforeEach
1314
public void setUp() throws Exception {
1415
}
1516

16-
@After
17+
@AfterEach
1718
public void tearDown() throws Exception {
1819
Task.clearAllTasks(); // clear out all the tasks before each test
1920
}
2021

2122
@Test
2223
public void NewTaskObjectGetsCorrectlyCreated_true() throws Exception {
2324
Task task = setupNewTask();
24-
assertEquals(true, task instanceof Task);
25+
Assertions.assertEquals(true, task instanceof Task);
2526
}
2627

2728
@Test
2829
public void TaskInstantiatesWithDescription_true() throws Exception {
2930
Task task = setupNewTask();
30-
assertEquals("Mow the lawn", task.getDescription());
31+
Assertions.assertEquals("Mow the lawn", task.getDescription());
3132
}
3233

3334
@Test
3435
public void AllTasksAreCorrectlyReturned_true() throws Exception {
3536
Task task = setupNewTask();
3637
Task otherTask = new Task("Brush the cat");
37-
assertEquals(2, Task.getAll().size());
38+
Assertions.assertEquals(2, Task.getAll().size());
3839
}
3940

4041
@Test
4142
public void AllTasksContainsAllTasks_true() throws Exception {
4243
Task task = setupNewTask();
4344
Task otherTask = new Task("Brush the cat");
44-
assertTrue(Task.getAll().contains(task));
45-
assertTrue(Task.getAll().contains(otherTask));
45+
Assertions.assertTrue(Task.getAll().contains(task));
46+
Assertions.assertTrue(Task.getAll().contains(otherTask));
4647
}
4748

4849
@Test
4950
public void isCompletedPropertyIsFalseAfterInstantiation() throws Exception {
5051
Task task = setupNewTask();
51-
assertEquals(false, task.getCompleted()); //should never start as completed
52+
Assertions.assertEquals(false, task.getCompleted()); //should never start as completed
5253
}
5354

5455
@Test
5556
public void getCreatedAtInstantiatesWithCurrentTimeToday() throws Exception {
5657
Task task = setupNewTask();
57-
assertEquals(LocalDateTime.now().getDayOfWeek(), task.getCreatedAt().getDayOfWeek());
58+
Assertions.assertEquals(LocalDateTime.now().getDayOfWeek(), task.getCreatedAt().getDayOfWeek());
5859
}
5960

6061
@Test
6162
public void tasksInstantiateWithId() throws Exception {
6263
Task task = setupNewTask();
63-
assertEquals(1, task.getId());
64+
Assertions.assertEquals(1, task.getId());
6465
}
6566

6667
@Test
6768
public void findReturnsCorrectTask() throws Exception {
6869
Task task = setupNewTask();
69-
assertEquals(1, Task.findById(task.getId()).getId());
70+
Assertions.assertEquals(1, Task.findById(task.getId()).getId());
7071
}
7172

7273

7374
@Test
7475
public void findReturnsCorrectTaskWhenMoreThanOneTaskExists() throws Exception {
7576
Task task = setupNewTask();
7677
Task otherTask = new Task("Brush the cat");
77-
assertEquals(2, Task.findById(otherTask.getId()).getId());
78+
Assertions.assertEquals(2, Task.findById(otherTask.getId()).getId());
7879
}
7980

8081
@Test
@@ -86,27 +87,27 @@ public void updateChangesTaskContent() throws Exception {
8687

8788
task.update("Floss the cat");
8889

89-
assertEquals(formerId, task.getId());
90-
assertEquals(formerDate, task.getCreatedAt());
91-
assertNotEquals(formerContent, task.getDescription());
90+
Assertions.assertEquals(formerId, task.getId());
91+
Assertions.assertEquals(formerDate, task.getCreatedAt());
92+
Assertions.assertNotEquals(formerContent, task.getDescription());
9293
}
9394

9495
@Test
9596
public void deleteDeletesASpecificTask() throws Exception {
9697
Task task = setupNewTask();
9798
Task otherTask = new Task("Brush the cat");
9899
task.deleteTask();
99-
assertEquals(1, Task.getAll().size()); //one is left
100-
assertEquals(Task.getAll().get(0).getId(), 2); //the one that was deleted has the id of 2
100+
Assertions.assertEquals(1, Task.getAll().size()); //one is left
101+
Assertions.assertEquals(Task.getAll().get(0).getId(), 2); //the one that was deleted has the id of 2
101102
}
102103

103-
@Test
104-
public void deleteAllTasksDeletesAllTasks() throws Exception {
105-
Task task = setupNewTask();
106-
Task otherTask = setupNewTask();
107-
Task.clearAllTasks();
108-
assertEquals(0, Task.getAll().size());
109-
}
104+
// @Test
105+
// public void deleteAllTasksDeletesAllTasks() throws Exception {
106+
// Task task = setupNewTask();
107+
// Task otherTask = setupNewTask();
108+
// Task.clearAllTasks();
109+
// assertEquals(0, Task.getAll().size());
110+
// }
110111

111112

112113
//helper methods

0 commit comments

Comments
 (0)