Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AB2D-6146] increase ab2d-contracts-client coverage #397

Merged
merged 6 commits into from
Jun 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package gov.cms.ab2d.contracts.model;

import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;

import org.junit.jupiter.api.Test;

class ContractDTOTest {

@Test
void testHasDateIssueCaseOne() {
ContractDTO contractDTO = new ContractDTO();
contractDTO.setContractType(Contract.ContractType.CLASSIC_TEST);
assertTrue(contractDTO.hasDateIssue());
}

@Test
void testHasDateIssueCaseTwo() {
ContractDTO contractDTO = new ContractDTO();
contractDTO.setContractType(Contract.ContractType.NORMAL);
assertFalse(contractDTO.hasDateIssue());
}

}
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
package gov.cms.ab2d.contracts.utils;
package gov.cms.ab2d.contracts.model;

import gov.cms.ab2d.contracts.model.Contract;
import gov.cms.ab2d.contracts.model.ContractDTO;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import java.time.OffsetDateTime;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;

public class ContractTest {
class ContractTest {
private static final String CONTRACT_NAME = "Name";
private static final String PARENT_NAME = "Parent";
private static final String MARKETING_NAME = "Marketing Name";
private static final String CONTRACT_NUMBER = "S12345";
private static final OffsetDateTime NOW = OffsetDateTime.now();
private static final DateTimeFormatter FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd H:m:s");
private static final String NOW_STRING = NOW.format(FORMATTER).toString();
private static final Long ID = 1L;
private static final Long PARENT_ID = 2L;
private static final Integer MEDICARE_ELIGIBLE = 95;
Expand Down Expand Up @@ -54,8 +55,32 @@ void testContract() {
TOTAL_ENROLLMENT - 1, MEDICARE_ELIGIBLE));
assertTrue(contract.hasChanges(MARKETING_NAME, PARENT_ID, PARENT_NAME, MARKETING_NAME,
null, null));
assertFalse(contract.hasChanges(CONTRACT_NAME, PARENT_ID, PARENT_NAME, MARKETING_NAME,
TOTAL_ENROLLMENT, MEDICARE_ELIGIBLE));
}

@Test
void testUpdateAttestationCaseOne() {
assertTrue(contract.updateAttestation(false, NOW_STRING));
}

@Test
void testUpdateAttestationCaseTwo() {
contract.setUpdateMode(Contract.UpdateMode.MANUAL);
assertFalse(contract.updateAttestation(false, NOW_STRING));
}

@Test
void testUpdateAttestationCaseThree() {
contract.setAttestedOn(null);
assertTrue(contract.updateAttestation(true, NOW_STRING));
}

@Test
void testUpdateAttestationCaseFour() {
contract.setAttestedOn(null);
assertFalse(contract.updateAttestation(false, NOW_STRING));
}

@Test
void testOther() {
Expand Down
Loading