Skip to content

Commit

Permalink
update to fix codesmell and add test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
Rwolfe-Nava committed Jun 12, 2024
1 parent b18ae2f commit 0307cc8
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ public OptOutResults getOptOutResults() {
int numberOptedOut = 0;

for (OptOutInformation optOut : optOutInformationList) {
if (optOut.getOptOutFlag()) {
if (optOut.getOptOutFlag() == true) {
numberOptedIn++;
} else {
numberOptedOut++;
Expand Down
24 changes: 24 additions & 0 deletions optout/src/test/java/gov/cms/ab2d/optout/OptOutResultsTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package gov.cms.ab2d.optout;

import static org.junit.Assert.assertEquals;

import org.junit.Test;

public class OptOutResultsTest {

@Test
public void itStoresValuesCorrectly() {
int todayOptIn = 1;
int todayOptOut = 1;

int totalOptedIn = 1;
int totalOptedOut = 1;
OptOutResults optOutResults = new OptOutResults(todayOptIn, todayOptOut, totalOptedIn, totalOptedOut);

assertEquals(todayOptIn, optOutResults.getOptInToday());
assertEquals(todayOptOut, optOutResults.getOptOutToday());
assertEquals(todayOptIn + todayOptOut, optOutResults.getTotalToday());
assertEquals(totalOptedIn + totalOptedOut, optOutResults.getTotalAllTime());
}

}

0 comments on commit 0307cc8

Please sign in to comment.