@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); }
@Test public void toDouble_unexpected_class() throws Exception { throwable.expect(IllegalArgumentException.class); RubyUtils.toDouble(true); }