Skip to content
This repository has been archived by the owner on Mar 20, 2018. It is now read-only.

Commit

Permalink
More DateTimeFormatterBuilder tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jodastephen committed May 6, 2009
1 parent 57a39ec commit 901586c
Showing 1 changed file with 34 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import javax.time.calendar.DateTimeFieldRule;
import javax.time.calendar.ISOChronology;
import javax.time.calendar.format.DateTimeFormatterBuilder.SignStyle;
import javax.time.calendar.format.DateTimeFormatterBuilder.TextStyle;

import org.testng.annotations.BeforeMethod;
import org.testng.annotations.DataProvider;
Expand Down Expand Up @@ -136,6 +137,39 @@ public void test_appendValue_3arg_nullSignStyle() throws Exception {
builder.appendValue(DOM_RULE, 2, 3, null);
}

//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
public void test_appendText_1arg() throws Exception {
builder.appendText(MOY_RULE);
DateTimeFormatter f = builder.toFormatter();
assertEquals(f.toString(), "Text(ISO.MonthOfYear)");
}

@Test(expectedExceptions=NullPointerException.class)
public void test_appendText_1arg_null() throws Exception {
builder.appendText(null);
}

//-----------------------------------------------------------------------
public void test_appendText_2arg() throws Exception {
builder.appendText(MOY_RULE, TextStyle.SHORT);
DateTimeFormatter f = builder.toFormatter();
assertEquals(f.toString(), "Text(ISO.MonthOfYear,SHORT)");
}

@Test(expectedExceptions=NullPointerException.class)
public void test_appendText_2arg_nullRule() throws Exception {
builder.appendText(null, TextStyle.SHORT);
}

@Test(expectedExceptions=NullPointerException.class)
public void test_appendText_2arg_nullStyle() throws Exception {
builder.appendText(MOY_RULE, null);
}

//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
public void test_padNext() throws Exception {
builder.appendValue(MOY_RULE).padNext(2).appendValue(DOM_RULE).appendValue(DOW_RULE);
Expand Down

0 comments on commit 901586c

Please sign in to comment.