use of gov.cms.qpp.conversion.api.model.Metadata in project qpp-conversion-tool by CMSgov.
the class CpcFileServiceImplTest method testUnprocessFileByIdSuccess.
@Test
void testUnprocessFileByIdSuccess() {
Metadata returnedData = buildFakeMetadata(true, true);
when(dbService.getMetadataById(anyString())).thenReturn(returnedData);
when(dbService.write(any(Metadata.class))).thenReturn(CompletableFuture.completedFuture(returnedData));
String message = objectUnderTest.unprocessFileById(MEEP);
verify(dbService, times(1)).getMetadataById(MEEP);
verify(dbService, times(1)).write(returnedData);
assertThat(message).isEqualTo(CpcFileServiceImpl.FILE_FOUND_UNPROCESSED);
}
use of gov.cms.qpp.conversion.api.model.Metadata in project qpp-conversion-tool by CMSgov.
the class DbServiceImplTest method testNoWriteBecauseNoAudit.
@Test
void testNoWriteBecauseNoAudit() {
when(environment.getProperty(Constants.NO_AUDIT_ENV_VARIABLE)).thenReturn("trueOrSomething");
Metadata metadataIn = new Metadata();
metadataIn.setTin("testTin");
Metadata metadataOut = writeMeta(metadataIn);
verifyZeroInteractions(dbMapper);
assertWithMessage("The returned metadata must be an empty metadata.").that(metadataOut.getUuid()).isNull();
}
use of gov.cms.qpp.conversion.api.model.Metadata in project qpp-conversion-tool by CMSgov.
the class DbServiceImplTest method testWriteByEmpty.
@Test
void testWriteByEmpty() {
when(environment.getProperty(Constants.NO_AUDIT_ENV_VARIABLE)).thenReturn("");
Metadata meta = writeMeta();
assertThat(meta).isNotNull();
verify(dbMapper, times(1)).save(any(Metadata.class));
}
use of gov.cms.qpp.conversion.api.model.Metadata in project qpp-conversion-tool by CMSgov.
the class DbServiceImplTest method testWriteByNull.
@Test
void testWriteByNull() {
when(environment.getProperty(Constants.NO_AUDIT_ENV_VARIABLE)).thenReturn(null);
Metadata meta = writeMeta();
assertThat(meta).isNotNull();
verify(dbMapper, times(1)).save(any(Metadata.class));
}
use of gov.cms.qpp.conversion.api.model.Metadata in project qpp-conversion-tool by CMSgov.
the class DbServiceImplTest method testGetMetadataById.
@Test
void testGetMetadataById() {
String fakeUuid = "1337-f4ke-uuid";
when(dbMapper.load(eq(Metadata.class), anyString())).thenReturn(new Metadata());
Metadata fakeMetadata = underTest.getMetadataById(fakeUuid);
verify(dbMapper, times(1)).load(eq(Metadata.class), anyString());
assertThat(fakeMetadata).isNotNull();
}
Aggregations