Created
October 9, 2015 00:11
-
-
Save olafleur/d753dc74ed589ce18ff8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
public void 2001_isCommon() { | |
boolean result = isLeapYear(2001); | |
assertThat(result).isFalse(); | |
} | |
@Test | |
public void 1996_isLeap() { | |
boolean result = isLeapYear(1996); | |
assertThat(result).isTrue(); | |
} | |
// more test cases until there are enough to triangulate all the possible scenarios | |
boolean isLeapYear(int year) { | |
return ((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment