Skip to content

Commit

Permalink
test added
Browse files Browse the repository at this point in the history
  • Loading branch information
Felix Reimann committed Mar 15, 2018
1 parent 4c5e916 commit f11d5c9
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,24 +47,24 @@ public Month toMonth() {
return Month.JANUARY;
case FEBRUARY:
return Month.FEBRUARY;
case APRIL:
return Month.APRIL;
case AUGUST:
return Month.AUGUST;
case JULY:
return Month.JULY;
case JUNE:
return Month.JUNE;
case MARCH:
return Month.MARCH;
case APRIL:
return Month.APRIL;
case MAY:
return Month.MAY;
case NOVEMBER:
return Month.NOVEMBER;
case OCTOBER:
return Month.OCTOBER;
case JUNE:
return Month.JUNE;
case JULY:
return Month.JULY;
case AUGUST:
return Month.AUGUST;
case SEPTEMBER:
return Month.SEPTEMBER;
case OCTOBER:
return Month.OCTOBER;
case NOVEMBER:
return Month.NOVEMBER;
case DECEMBER:
return Month.DECEMBER;
default:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package org.opt4j.core.config.annotations;

import java.time.DateTimeException;
import java.time.Month;

import org.junit.Assert;
import org.junit.Test;
import org.opt4j.core.config.annotations.Citation.PublicationMonth;

public class CitationTest {
@Test
public void toMonth() {
Assert.assertEquals(Month.JANUARY, PublicationMonth.JANUARY.toMonth());
Assert.assertEquals(Month.FEBRUARY, PublicationMonth.FEBRUARY.toMonth());
Assert.assertEquals(Month.MARCH, PublicationMonth.MARCH.toMonth());
Assert.assertEquals(Month.APRIL, PublicationMonth.APRIL.toMonth());
Assert.assertEquals(Month.MAY, PublicationMonth.MAY.toMonth());
Assert.assertEquals(Month.JUNE, PublicationMonth.JUNE.toMonth());
Assert.assertEquals(Month.JULY, PublicationMonth.JULY.toMonth());
Assert.assertEquals(Month.AUGUST, PublicationMonth.AUGUST.toMonth());
Assert.assertEquals(Month.SEPTEMBER, PublicationMonth.SEPTEMBER.toMonth());
Assert.assertEquals(Month.OCTOBER, PublicationMonth.OCTOBER.toMonth());
Assert.assertEquals(Month.NOVEMBER, PublicationMonth.NOVEMBER.toMonth());
Assert.assertEquals(Month.DECEMBER, PublicationMonth.DECEMBER.toMonth());
}

@Test(expected = DateTimeException.class)
public void toMonthUnkown() {
PublicationMonth.UNKNOWN.toMonth();
}

@Test
public void valueOf() {
Assert.assertEquals(PublicationMonth.JANUARY, PublicationMonth.valueOf("JANUARY"));
}
}

0 comments on commit f11d5c9

Please sign in to comment.