Skip to content

Commit fa648bb

Browse files
committed
Updates to Week 7
1 parent 6729a20 commit fa648bb

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

  • Week-07-Testing-AOP/Demo/demo-mvc/src/test/java/com/codingnomads/demo_web/services

β€ŽWeek-07-Testing-AOP/Demo/demo-mvc/src/test/java/com/codingnomads/demo_web/services/TodoServiceTest.javaβ€Ž

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,13 @@ void getAllTodos_false() {
6565
assertEquals(1, result.size());
6666
verify(todoRepository, times(1)).findAll();
6767
}
68+
69+
@Test
70+
void getTodosWithoutList_exception() {
71+
when(todoRepository.findAllWithoutList()).thenThrow(new RuntimeException());
72+
73+
assertThrows(RuntimeException.class, () -> todoService.getTodosWithoutList());
74+
75+
verify(todoRepository, times(1)).findAllWithoutList();
76+
}
6877
}

0 commit comments

Comments
 (0)