コード例 #1
0
ファイル: TypeTest.java プロジェクト: JackSullivan/bazel
 @Test
 public void testNonInteger() throws Exception {
   try {
     Type.INTEGER.convert("foo", null);
     fail();
   } catch (Type.ConversionException e) {
     // This does not use assertMessageContainsWordsWithQuotes because at least
     // one test should test exact wording (but they all shouldn't to make
     // changing/improving the messages easy).
     assertThat(e).hasMessage("expected value of type 'int', but got \"foo\" (string)");
   }
 }
コード例 #2
0
ファイル: TypeTest.java プロジェクト: JackSullivan/bazel
 @Test
 public void testInteger() throws Exception {
   Object x = 3;
   assertEquals(x, Type.INTEGER.convert(x, null));
   assertThat(Type.INTEGER.flatten(x)).isEmpty();
 }