Skip to content

Commit

Permalink
rework tests to minimize warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
laffer1 committed Jan 4, 2024
1 parent 4004724 commit 3af7212
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,21 +42,19 @@ public void setup() {
arch.setName("NAME");
arch.setId(1);
arch.setCreated(Calendar.getInstance().getTime());

when(architectureService.list()).thenReturn(Collections.singletonList(arch));
when(architectureService.get(1)).thenReturn(arch);
when(architectureService.getByName("NAME")).thenReturn(arch);
}

@Test
void testList() {
when(architectureService.list()).thenReturn(Collections.singletonList(arch));
final ResponseEntity<List<Architecture>> result = controller.list();
assertNotNull(result);
assertEquals(1, result.getBody().size());
}

@Test
void testGet() {
when(architectureService.get(1)).thenReturn(arch);
final ResponseEntity<Architecture> result = controller.get(1);
assertNotNull(result);
assertEquals("NAME", result.getBody().getName());
Expand All @@ -65,6 +63,7 @@ void testGet() {

@Test
void testGetByName() {
when(architectureService.getByName("NAME")).thenReturn(arch);
final ResponseEntity<Architecture> result = controller.get("NAME");
assertNotNull(result);
assertEquals("NAME", result.getBody().getName());
Expand Down

0 comments on commit 3af7212

Please sign in to comment.