I have a suggestion for this test case:
In the setup method, add these three lines after design.setName("Test Taco"):
design.setId(1L);
when (designRepository.findByName("Test Taco")).thenReturn(design);
when (designRepository.findById(1L)).thenReturn(Optional.of(design));
In the processDesign(), add these unit test cases:
Optional mytaco = designRepository.findById(1L) ;
Assert.notNull(mytaco.get(), "taco created");
Long id = mytaco.get().getId();
Assert.isTrue(id==1L,"id is 1");
Taco t = designRepository.findByName("Test Taco");
Assert.isTrue(t.getName().equals("Test Taco"), "taco is test taco");
In TacoRepository.java, add
public Taco findByName(String name);
I have a suggestion for this test case: In the setup method, add these three lines after design.setName("Test Taco"): design.setId(1L); when (designRepository.findByName("Test Taco")).thenReturn(design); when (designRepository.findById(1L)).thenReturn(Optional.of(design));
In the processDesign(), add these unit test cases: Optional mytaco = designRepository.findById(1L) ;
In TacoRepository.java, add public Taco findByName(String name);