Summary Table
Categories |
Total Count |
PII |
0 |
URL |
0 |
DNS |
0 |
EKL |
0 |
IP |
0 |
PORT |
0 |
VsID |
0 |
CF |
0 |
AI |
0 |
VPD |
0 |
PL |
0 |
Other |
0 |
File Content
package gov.va.oneconsult.seoc.api.repository;
import static org.assertj.core.api.Assertions.assertThat;
import java.util.HashSet;
import java.util.Set;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest;
import org.springframework.boot.test.autoconfigure.orm.jpa.TestEntityManager;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import gov.va.oneconsult.seoc.api.model.ClinicalService;
import gov.va.oneconsult.seoc.api.model.Hptc;
import gov.va.oneconsult.seoc.api.model.ServiceHptc;
import gov.va.oneconsult.seoc.api.model.ServiceHptcId;
/**
* @author AbleVets
*/
@RunWith(SpringJUnit4ClassRunner.class)
@DataJpaTest
public class ServiceHptcRepositoryTest
{
@Autowired
private ServiceHptcRepository serviceHptcRepository;
@Autowired
private TestEntityManager entityManager;
private Hptc hptc1 = null;
private Hptc hptc2 = null;
private ServiceHptc serviceHptc1 = null;
private ServiceHptc serviceHptc2 = null;
private ClinicalService cs = null;
@Before
public void setUp()
{
cs = new ClinicalService();
cs.setDescription("20-TestServiceHptc");
hptc1 = new Hptc();
hptc1.setHptc("hptc177");
hptc1.setClassification("TYPE2");
hptc1.setSpecialization("SPEC2");
hptc1.setGrouping("GROUP2");
serviceHptc1 = new ServiceHptc(new ServiceHptcId(hptc1.getHptc(), "20"));
hptc2 = new Hptc();
hptc2.setHptc("hptc178");
hptc2.setClassification("TYPE2");
hptc2.setSpecialization("SPEC2");
hptc2.setGrouping("GROUP2");
serviceHptc2 = new ServiceHptc(new ServiceHptcId(hptc2.getHptc(), "20"));
entityManager.persist(hptc1);
entityManager.persist(hptc2);
entityManager.persist(cs);
entityManager.persist(serviceHptc1);
entityManager.persist(serviceHptc2);
}
@After
public void tearDown()
{
entityManager.detach(serviceHptc1);
entityManager.detach(serviceHptc2);
entityManager.detach(cs);
entityManager.detach(hptc1);
entityManager.detach(hptc2);
}
@Test
public void findHptcByMsc()
{
Set<ServiceHptc> expectedServiceHptcs = new HashSet<ServiceHptc>();
expectedServiceHptcs.add(serviceHptc1);
expectedServiceHptcs.add(serviceHptc2);
Set<ServiceHptc> actualServiceHptcs = serviceHptcRepository.findByMedicareCode("20");
assertThat(expectedServiceHptcs).isEqualTo(actualServiceHptcs);
}
}