Commit 13850ad0 authored by luc chatty's avatar luc chatty
Browse files

PATREG-33 | update unitary tests

parent 99e7be14
Pipeline #137588 failed with stages
in 2 minutes and 51 seconds
...@@ -3,13 +3,14 @@ package net.ihe.gazelle.app.patientregistryservice.adapter.dao.pamsimulator.serv ...@@ -3,13 +3,14 @@ package net.ihe.gazelle.app.patientregistryservice.adapter.dao.pamsimulator.serv
import javax.persistence.criteria.*; import javax.persistence.criteria.*;
import javax.persistence.metamodel.*; import javax.persistence.metamodel.*;
import java.util.Collection; import java.util.Collection;
import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
public class FromTestModel implements From { public class FromTestModel implements From {
@Override @Override
public Set<Join> getJoins() { public Set<Join> getJoins() {
return null; return new HashSet<>();
} }
@Override @Override
...@@ -54,7 +55,7 @@ public class FromTestModel implements From { ...@@ -54,7 +55,7 @@ public class FromTestModel implements From {
@Override @Override
public ListJoin joinList(String s) { public ListJoin joinList(String s) {
return null; return new JoinTestModel();
} }
@Override @Override
...@@ -69,7 +70,7 @@ public class FromTestModel implements From { ...@@ -69,7 +70,7 @@ public class FromTestModel implements From {
@Override @Override
public Join join(String s) { public Join join(String s) {
return null; return new JoinTestModel();
} }
@Override @Override
...@@ -79,7 +80,7 @@ public class FromTestModel implements From { ...@@ -79,7 +80,7 @@ public class FromTestModel implements From {
@Override @Override
public ListJoin join(ListAttribute listAttribute, JoinType joinType) { public ListJoin join(ListAttribute listAttribute, JoinType joinType) {
return null; return new JoinTestModel();
} }
@Override @Override
...@@ -99,7 +100,7 @@ public class FromTestModel implements From { ...@@ -99,7 +100,7 @@ public class FromTestModel implements From {
@Override @Override
public ListJoin join(ListAttribute listAttribute) { public ListJoin join(ListAttribute listAttribute) {
return null; return new JoinTestModel();
} }
@Override @Override
...@@ -114,12 +115,12 @@ public class FromTestModel implements From { ...@@ -114,12 +115,12 @@ public class FromTestModel implements From {
@Override @Override
public Join join(SingularAttribute singularAttribute, JoinType joinType) { public Join join(SingularAttribute singularAttribute, JoinType joinType) {
return null; return new JoinTestModel();
} }
@Override @Override
public Join join(SingularAttribute singularAttribute) { public Join join(SingularAttribute singularAttribute) {
return null; return new JoinTestModel();
} }
@Override @Override
......
package net.ihe.gazelle.app.patientregistryservice.adapter.dao.pamsimulator.service.patient.search;
import javax.persistence.criteria.*;
import javax.persistence.metamodel.*;
public class JoinTestModel extends FromTestModel implements ListJoin {
@Override
public ListAttribute getModel() {
return null;
}
@Override
public ListJoin on(Expression restriction) {
return null;
}
@Override
public ListJoin on(Predicate... restrictions) {
return null;
}
@Override
public Predicate getOn() {
return null;
}
@Override
public Attribute getAttribute() {
return null;
}
@Override
public From getParent() {
return null;
}
@Override
public JoinType getJoinType() {
return null;
}
@Override
public Expression<Integer> index() {
return null;
}
}
...@@ -32,7 +32,7 @@ public class PatientSearchCriterionJPAMappingServiceTest { ...@@ -32,7 +32,7 @@ public class PatientSearchCriterionJPAMappingServiceTest {
* Test from returned for uuid is not null * Test from returned for uuid is not null
*/ */
@Test @Test
public void from_uuid(){ public void fromUuid(){
From originalFrom = new FromTestModel(); From originalFrom = new FromTestModel();
From from = new PatientSearchCriterionJPAMappingService(entityManager).from(PatientSearchCriterionKey.UUID, originalFrom); From from = new PatientSearchCriterionJPAMappingService(entityManager).from(PatientSearchCriterionKey.UUID, originalFrom);
...@@ -40,6 +40,30 @@ public class PatientSearchCriterionJPAMappingServiceTest { ...@@ -40,6 +40,30 @@ public class PatientSearchCriterionJPAMappingServiceTest {
assertEquals(originalFrom, from); assertEquals(originalFrom, from);
} }
/**
* Test from returned for domain is not null
*/
@Test
public void fromDomain(){
From originalFrom = new FromTestModel();
From from = new PatientSearchCriterionJPAMappingService(entityManager).from(PatientSearchCriterionKey.DOMAIN, originalFrom);
assertNotNull(from, "from should not be null for domain");
}
/**
* Test from returned for identifier is not null
*/
@Test
public void fromIdentifier(){
From originalFrom = new FromTestModel();
From from = new PatientSearchCriterionJPAMappingService(entityManager).from(PatientSearchCriterionKey.IDENTIFIER, originalFrom);
assertNotNull(from, "from should not be null for identifier");
}
/** /**
* Test unknown key generate an exception * Test unknown key generate an exception
*/ */
......
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