-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add some (not super-useful) unit tests for ResultResolver
- Loading branch information
1 parent
e2f9607
commit db26d6e
Showing
2 changed files
with
52 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 28 additions & 25 deletions
53
backend/src/test/java/gov/cdc/usds/simplereport/api/testresult/ResultResolverTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,54 @@ | ||
package gov.cdc.usds.simplereport.api.testresult; | ||
|
||
import static org.mockito.Mockito.mock; | ||
import static org.mockito.Mockito.times; | ||
import static org.mockito.Mockito.verify; | ||
import static org.mockito.Mockito.when; | ||
|
||
import gov.cdc.usds.simplereport.service.DiseaseService; | ||
import gov.cdc.usds.simplereport.service.ResultService; | ||
import java.util.UUID; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.ExtendWith; | ||
import org.mockito.Mock; | ||
import org.springframework.data.domain.Page; | ||
import org.springframework.test.context.junit.jupiter.SpringExtension; | ||
|
||
@ExtendWith(SpringExtension.class) | ||
public class ResultResolverTest { | ||
@Mock ResultService resultService; | ||
|
||
// @InjectMocks | ||
// OrganizationResolver organizationMutationResolver; | ||
|
||
@Test | ||
void resultsPage_usesDefaultPaginationNumber() { | ||
// GIVEN | ||
|
||
// WHEN | ||
|
||
// THEN | ||
} | ||
|
||
@Test | ||
void resultsPage_usesDefaultPaginationSize() { | ||
// GIVEN | ||
|
||
// WHEN | ||
|
||
// THEN | ||
} | ||
|
||
class ResultResolverTest { | ||
@Test | ||
void resultsPage_facilityId_null_returnsResultsForOrganization() { | ||
// GIVEN | ||
ResultService resultService = mock(ResultService.class); | ||
DiseaseService diseaseService = mock(DiseaseService.class); | ||
|
||
var sut = new ResultResolver(resultService, diseaseService); | ||
|
||
// WHEN | ||
when(resultService.getOrganizationResults(null, null, null, null, null, null, 0, 20)) | ||
.thenReturn(Page.empty()); | ||
sut.resultsPage(null, null, null, null, null, null, null, 0, 20); | ||
|
||
// THEN | ||
verify(resultService, times(1)) | ||
.getOrganizationResults(null, null, null, null, null, null, 0, 20); | ||
} | ||
|
||
@Test | ||
void resultsPage_facilityId_notNull_returnsResultsForFacility() { | ||
// GIVEN | ||
ResultService resultService = mock(ResultService.class); | ||
DiseaseService diseaseService = mock(DiseaseService.class); | ||
|
||
var facilityId = UUID.randomUUID(); | ||
var sut = new ResultResolver(resultService, diseaseService); | ||
|
||
// WHEN | ||
when(resultService.getFacilityResults(facilityId, null, null, null, null, null, null, 0, 20)) | ||
.thenReturn(Page.empty()); | ||
sut.resultsPage(facilityId, null, null, null, null, null, null, 0, 20); | ||
|
||
// THEN | ||
verify(resultService, times(1)) | ||
.getFacilityResults(facilityId, null, null, null, null, null, null, 0, 20); | ||
} | ||
} |