Skip to content

Commit

Permalink
[AB2D-6146] increase ab2d-contracts-client coverage (#397)
Browse files Browse the repository at this point in the history
* move file

* ContractTest

* typo

* typo

* ContractDTOTest

* private
  • Loading branch information
coilysiren authored Jun 24, 2024
1 parent d2783b5 commit ce90eb6
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 4 deletions.
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

0 comments on commit ce90eb6

Please sign in to comment.