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.Set;
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.test.context.junit4.SpringJUnit4ClassRunner;
import gov.va.oneconsult.seoc.api.controller.SeocObjectGenerator;
import gov.va.oneconsult.seoc.api.model.CategoryOfCare;
import gov.va.oneconsult.seoc.api.model.ServiceLine;
/**
* @author AbleVets
*
*/
@RunWith(SpringJUnit4ClassRunner.class)
@DataJpaTest
public class CategoryOfCareRepositoryTest
{
@Autowired
private ServiceLineRepository serviceLineRepository;
@Autowired
private CategoryOfCareRepository categoryOfCareRepository;
@Test
public void findAllCategoriesOfCare_returnsOnlyActiveCategoriesOfCare()
{
ServiceLine serviceLine = SeocObjectGenerator.getServiceLine(0, "Description", "ABR");
ServiceLine savedServiceLine = serviceLineRepository.save(serviceLine);
CategoryOfCare categoryOfCare = SeocObjectGenerator.getCategoryOfCare(0, "Description");
categoryOfCare.setServiceLine(savedServiceLine);
CategoryOfCare savedCategoryOfCare = categoryOfCareRepository.save(categoryOfCare);
Set<CategoryOfCare> categoriesOfCare = categoryOfCareRepository.findAllCategoriesOfCare();
assertThat(categoriesOfCare).isNotNull();
assertThat(categoriesOfCare).contains(savedCategoryOfCare);
CategoryOfCare categoryOfCareAfter = categoryOfCareRepository.findByDescription("Description");
categoryOfCareAfter.setDiscontinued(true);
savedCategoryOfCare = categoryOfCareRepository.save(categoryOfCareAfter);
Set<CategoryOfCare> categoriesOfCareAfter = categoryOfCareRepository.findAllCategoriesOfCare();
assertThat(categoriesOfCareAfter).isNotNull();
assertThat(categoriesOfCareAfter).doesNotContain(savedCategoryOfCare);
}
}