Made tests go green

This commit is contained in:
Jens Kristian Villadsen 2024-09-16 16:11:38 +02:00
parent 72ba7cd1c2
commit 698c821dc0
1 changed files with 6 additions and 3 deletions

View File

@ -131,6 +131,8 @@ public class PackageInstallerSvcImplTest {
private ArgumentCaptor<SearchParameter> mySearchParameterCaptor; private ArgumentCaptor<SearchParameter> mySearchParameterCaptor;
@Captor @Captor
private ArgumentCaptor<RequestDetails> myRequestDetailsCaptor; private ArgumentCaptor<RequestDetails> myRequestDetailsCaptor;
@Captor
private ArgumentCaptor<String> myMathcUrlCaptor;
@Test @Test
public void testPackageCompatibility() { public void testPackageCompatibility() {
@ -257,7 +259,7 @@ public class PackageInstallerSvcImplTest {
SearchParameterMap map = mySearchParameterMapCaptor.getValue(); SearchParameterMap map = mySearchParameterMapCaptor.getValue();
assertEquals("?url=http%3A%2F%2Fmy-code-system", map.toNormalizedQueryString(myCtx)); assertEquals("?url=http%3A%2F%2Fmy-code-system", map.toNormalizedQueryString(myCtx));
verify(myCodeSystemDao, times(1)).update(myCodeSystemCaptor.capture(), any(RequestDetails.class)); verify(myCodeSystemDao, times(1)).update(myCodeSystemCaptor.capture(), any(String.class) , any(RequestDetails.class));
CodeSystem codeSystem = myCodeSystemCaptor.getValue(); CodeSystem codeSystem = myCodeSystemCaptor.getValue();
assertEquals("existingcs", codeSystem.getIdPart()); assertEquals("existingcs", codeSystem.getIdPart());
} }
@ -295,9 +297,9 @@ public class PackageInstallerSvcImplTest {
if (theInstallType == InstallType.CREATE) { if (theInstallType == InstallType.CREATE) {
verify(mySearchParameterDao, times(1)).create(mySearchParameterCaptor.capture(), myRequestDetailsCaptor.capture()); verify(mySearchParameterDao, times(1)).create(mySearchParameterCaptor.capture(), myRequestDetailsCaptor.capture());
} else if (theInstallType == InstallType.UPDATE_WITH_EXISTING){ } else if (theInstallType == InstallType.UPDATE_WITH_EXISTING){
verify(mySearchParameterDao, times(2)).update(mySearchParameterCaptor.capture(), myRequestDetailsCaptor.capture()); verify(mySearchParameterDao, times(2)).update(mySearchParameterCaptor.capture(), myMathcUrlCaptor.capture(), myRequestDetailsCaptor.capture());
} else { } else {
verify(mySearchParameterDao, times(1)).update(mySearchParameterCaptor.capture(), myRequestDetailsCaptor.capture()); verify(mySearchParameterDao, times(1)).update(mySearchParameterCaptor.capture(), myMathcUrlCaptor.capture(), myRequestDetailsCaptor.capture());
} }
Iterator<SearchParameter> iteratorSP = mySearchParameterCaptor.getAllValues().iterator(); Iterator<SearchParameter> iteratorSP = mySearchParameterCaptor.getAllValues().iterator();
@ -366,6 +368,7 @@ public class PackageInstallerSvcImplTest {
if (theId != null) { if (theId != null) {
searchParameter.setId(new IdType("SearchParameter", theId)); searchParameter.setId(new IdType("SearchParameter", theId));
} }
searchParameter.setUrl("http://example.com/SearchParameter");
searchParameter.setCode("someCode"); searchParameter.setCode("someCode");
theBase.forEach(base -> searchParameter.getBase().add(new CodeType(base))); theBase.forEach(base -> searchParameter.getBase().add(new CodeType(base)));
searchParameter.setExpression("someExpression"); searchParameter.setExpression("someExpression");