Skip to content
Open
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
1 change: 0 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
"files.autoSave": "afterDelay",
"screencastMode.onlyKeyboardShortcuts": true,
"terminal.integrated.fontSize": 18,
"workbench.activityBar.visible": true,
"workbench.colorTheme": "Visual Studio Dark",
"workbench.fontAliasing": "antialiased",
"workbench.statusBar.visible": true,
Expand Down
12 changes: 11 additions & 1 deletion src/main/java/DateChecker.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,18 @@ enum Month {
DECEMBER
}

private Month[] m31Days = {Month.JANUARY, Month.MARCH, Month.MAY, Month.JULY, Month.AUGUST, Month.OCTOBER, Month.DECEMBER};

public Month[] get31Days() {
return m31Days;
}

public boolean has31Days(Month month) {
return false;
if(Arrays.asList(m31Days).contains(month)) {
return true;
} else {
return false;
}
}


Expand Down
18 changes: 14 additions & 4 deletions src/test/java/DateCheckerTest.java
Original file line number Diff line number Diff line change
@@ -1,17 +1,27 @@
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.EnumSource;

import static org.junit.jupiter.api.Assertions.*;

import java.time.Month;

class DateCheckerTest {

DateChecker dateChecker = new DateChecker();

@Test
public void testHas31Days() {
@ParameterizedTest
@EnumSource(value = DateChecker.Month.class, names = { "JANUARY", "MARCH", "MAY", "JULY", "AUGUST", "OCTOBER",
"DECEMBER" })
public void testHas31Days(DateChecker.Month month) {
assertTrue(dateChecker.has31Days(month));

}

@Test
public void testDoesNotHave31Days() {
@ParameterizedTest
@EnumSource(value = DateChecker.Month.class, names = { "FEBRUARY", "APRIL", "JUNE", "SEPTEMBER", "NOVEMBER" })
public void testDoesNotHave31Days(DateChecker.Month month) {
assertFalse(dateChecker.has31Days(month));

}

Expand Down