Exemplo n.º 1
0
 @Test
 public void toDate() throws Exception {
   assertThat(RubyUtils.toDate(null)).isNull();
   assertThat(RubyUtils.toDate("")).isNull();
   assertThat(RubyUtils.toDate("   ")).isNull();
   assertThat(RubyUtils.toDate("2013-01-18").getDate()).isEqualTo(18);
   assertThat(RubyUtils.toDate("2013-01-18T15:38:19+0200").getDate()).isEqualTo(18);
   assertThat(RubyUtils.toDate("2013-01-18T15:38:19+0200").getMinutes()).isEqualTo(38);
   assertThat(RubyUtils.toDate(DateUtils.parseDate("2013-01-18")).getDate()).isEqualTo(18);
 }
Exemplo n.º 2
0
  @Test
  public void toDate_unexpected_class() throws Exception {
    throwable.expect(IllegalArgumentException.class);

    RubyUtils.toDate(333);
  }
Exemplo n.º 3
0
  @Test
  public void toDate_bad_format() throws Exception {
    throwable.expect(SonarException.class);

    RubyUtils.toDate("01/02/2013");
  }