예제 #1
0
 /** parses standard date string. */
 @Test
 public void parse_standard() {
   Date date = Date.valueOf("1234-01-02", Date.Format.STANDARD);
   assertThat(date.getYear(), is(1234));
   assertThat(date.getMonth(), is(1));
   assertThat(date.getDay(), is(2));
 }
예제 #2
0
 /** 単純な文字列解析。 */
 @Test
 public void parse() {
   Date date = Date.valueOf("12340102", Date.Format.SIMPLE);
   assertThat(date.getYear(), is(1234));
   assertThat(date.getMonth(), is(1));
   assertThat(date.getDay(), is(2));
 }
예제 #3
0
 /** 大きな日付の文字列解析。 */
 @Test
 public void parse_big() {
   Date date = Date.valueOf("29991231", Date.Format.SIMPLE);
   assertThat(date.getYear(), is(2999));
   assertThat(date.getMonth(), is(12));
   assertThat(date.getDay(), is(31));
 }
예제 #4
0
 /** 最初の日付の文字列解析。 */
 @Test
 public void parse_zero() {
   Date date = Date.valueOf("00010101", Date.Format.SIMPLE);
   assertThat(date.getYear(), is(1));
   assertThat(date.getMonth(), is(1));
   assertThat(date.getDay(), is(1));
 }
예제 #5
0
 /** optionの解析。 */
 @Test
 public void parse_option() {
   StringOption option = new StringOption("20100615");
   Date date = Date.valueOf(option, Date.Format.SIMPLE);
   assertThat(date.getYear(), is(2010));
   assertThat(date.getMonth(), is(6));
   assertThat(date.getDay(), is(15));
 }
예제 #6
0
 /** nullの解析。 */
 @Test
 public void parse_null() {
   StringOption option = new StringOption(null);
   Date date = Date.valueOf(option, Date.Format.SIMPLE);
   assertThat(date, is(nullValue()));
 }