コード例 #1
0
 @Test
 public void toDouble() throws Exception {
   assertThat(RubyUtils.toDouble(null)).isNull();
   assertThat(RubyUtils.toDouble("")).isNull();
   assertThat(RubyUtils.toDouble("  ")).isNull();
   assertThat(RubyUtils.toDouble("123")).isEqualTo(123.0);
   assertThat(RubyUtils.toDouble("3.14")).isEqualTo(3.14);
   assertThat(RubyUtils.toDouble(3.14)).isEqualTo(3.14);
   assertThat(RubyUtils.toDouble(123)).isEqualTo(123.0);
   assertThat(RubyUtils.toDouble(123L)).isEqualTo(123.0);
 }
コード例 #2
0
  @Test
  public void toDouble_unexpected_class() throws Exception {
    throwable.expect(IllegalArgumentException.class);

    RubyUtils.toDouble(true);
  }