Skip to content
Snippets Groups Projects

Add Mockito.eq static method to check for equality in mocks

1 file
+ 4
4
Compare changes
  • Side-by-side
  • Inline
@@ -14,7 +14,6 @@ import nl.tudelft.ewi.auta.core.response.exception.NoResultsException;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.mockito.InjectMocks;
import org.mockito.Matchers;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
@@ -31,6 +30,7 @@ import java.util.Set;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.AdditionalMatchers.not;
import static org.mockito.ArgumentMatchers.eq;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.request;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
@@ -70,13 +70,13 @@ public class BenchmarkingControllerTest {
);
Mockito.when(this.repository.findExisting("aid", "sid"))
Mockito.when(this.repository.findExisting(eq("aid"), eq("sid")))
.thenReturn(new EntityContainer(this.projectEntity, "sid", false, null, "aid"));
Mockito.when(this.repository.findExisting(not(Matchers.eq("aid")),
Mockito.when(this.repository.findExisting(not(eq("aid")),
Mockito.anyString())).thenThrow(new NoResultsException());
Mockito.when(this.repository.findExisting(Mockito.anyString(),
not(Matchers.eq("sid")))).thenThrow(new NoResultsException());
not(eq("sid")))).thenThrow(new NoResultsException());
Mockito.when(this.benchmarker.aggregate(Mockito.any(), Mockito.any(), Mockito.any()))
.thenReturn(Map.of(1, 0.75, 10, 0.25));
Loading