Skip to content

Commit

Permalink
Oops
Browse files Browse the repository at this point in the history
  • Loading branch information
Julien Debon committed Apr 30, 2019
1 parent 555a3d5 commit 72c8286
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions java/src/test/java/InvariantTest.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assumptions.assumeThat;

import com.pholser.junit.quickcheck.Property;
import com.pholser.junit.quickcheck.runner.JUnitQuickcheck;
import java.time.LocalDate;
import org.junit.Before;
Expand All @@ -16,6 +18,18 @@ public void setUp() {
cut = new Invariant();
}

@Property
public void invariant_31_12(short anyYear) {
assertThat(cut.isNewYearEve(LocalDate.of(anyYear, 12, 31))).isTrue();
}

@Property(trials = 1000)
public void invariant_not_31_12(LocalDate anyDate) {
assumeThat(anyDate.getMonthValue() != 12 || anyDate.getDayOfMonth() != 31).isTrue();

assertThat(cut.isNewYearEve(anyDate)).isFalse();
}

@Test
public void _2018_12_31() {
assertThat(cut.isNewYearEve(LocalDate.of(2018, 12, 31))).isTrue();
Expand Down

0 comments on commit 72c8286

Please sign in to comment.