Attention une mise à jour du serveur va être effectuée le lundi 17 mai entre 13h et 13h30. Cette mise à jour va générer une interruption du service de quelques minutes.

Commit 3c327a09 authored by Wylem Bars's avatar Wylem Bars

PATREG-33 | Sonar analysis : update coverage

parent b89ac81c
Pipeline #138061 failed with stages
in 3 minutes and 4 seconds
......@@ -52,6 +52,20 @@ public class PatientSearchCriterionJPAMappingServiceTest {
assertNotNull(from, "from should not be null for domain");
}
/**
* Test from returned for domain is not null and is not created multiple times
*/
@Test
public void fromDomainMultiple() {
From originalFrom = new FromTestModel();
From from = new PatientSearchCriterionJPAMappingService(entityManager).from(PatientSearchCriterionKey.DOMAIN, originalFrom);
From from2 = new PatientSearchCriterionJPAMappingService(entityManager).from(PatientSearchCriterionKey.DOMAIN, originalFrom);
assertNotNull(from, "from should not be null for domain");
assertEquals(from, from2);
}
/**
* Test from returned for identifier is not null
*/
......@@ -64,6 +78,20 @@ public class PatientSearchCriterionJPAMappingServiceTest {
assertNotNull(from, "from should not be null for identifier");
}
/**
* Test from returned for identifier is not null and is not created multiple times
*/
@Test
public void fromIdentifierMultiple() {
From originalFrom = new FromTestModel();
From from = new PatientSearchCriterionJPAMappingService(entityManager).from(PatientSearchCriterionKey.IDENTIFIER, originalFrom);
From from2 = new PatientSearchCriterionJPAMappingService(entityManager).from(PatientSearchCriterionKey.IDENTIFIER, originalFrom);
assertNotNull(from, "from should not be null for identifier");
assertEquals(from, from2);
}
/**
* Test unknown key generate an exception
*/
......@@ -87,4 +115,53 @@ public class PatientSearchCriterionJPAMappingServiceTest {
}
},null));
}
/**
* Test the getter for the property name for uuid
*/
@Test
public void testGetEntityPropertyUUID() {
assertEquals("uuid", new PatientSearchCriterionJPAMappingService(entityManager).getEntityProperty(PatientSearchCriterionKey.UUID));
}
/**
* Test the getter for the property name for Identifier
*/
@Test
public void testGetEntityPropertyIdentifier() {
assertEquals("identifier",
new PatientSearchCriterionJPAMappingService(entityManager).getEntityProperty(PatientSearchCriterionKey.IDENTIFIER));
}
/**
* Test the getter for the property name for domain
*/
@Test
public void testGetEntityPropertyDomain() {
assertEquals("universalID", new PatientSearchCriterionJPAMappingService(entityManager).getEntityProperty(PatientSearchCriterionKey.DOMAIN));
}
/**
* Test the getter for the property name for unknown criterion
*/
@Test
public void testGetEntityPropertyUnknown() {
assertThrows(IllegalArgumentException.class,
() -> new PatientSearchCriterionJPAMappingService(entityManager).getEntityProperty(new SearchCriterionKey() {
@Override
public SearchCriterionOptions getDefaultOptions() {
return null;
}
@Override
public SearchCriterionOperator getDefaultOperator() {
return null;
}
@Override
public Class getValueClass() {
return null;
}
}));
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment