private void expectInvalidPattern(String pattern, String errorMessage) {
   try {
     Joda.forPattern(pattern);
     fail("Pattern " + pattern + " should have thrown an exception but did not");
   } catch (IllegalArgumentException e) {
     assertThat(e.getMessage(), containsString(errorMessage));
   }
 }
 @Test()
 public void shouldRejectInvalidExtraType() {
   try {
     IntentBuilder.build("intent action", new Pair<>("CustomThing", new CustomThing()));
     Assert.fail("Exception not thrown");
   } catch (IllegalArgumentException e) {
     assertThat(e.getMessage(), containsString("Illegal parameter type"));
   }
 }
Exemplo n.º 3
0
 @Test
 public void testCreateInstanceWithoutHttpHandler() throws Exception {
   try {
     new RestfitClient.Builder().userAgent("RestfitTest/1.0").build();
     fail("never reached");
   } catch (IllegalArgumentException e) {
     assertThat(e.getMessage(), is("No httpStack specified"));
   }
 }
Exemplo n.º 4
0
 @Test
 public void testCreateInstanceWithoutUserAgent() throws Exception {
   try {
     new RestfitClient.Builder().httpStack(new DummyHttpStack()).build();
     fail("never reached");
   } catch (IllegalArgumentException e) {
     assertThat(e.getMessage(), is("No userAgent specified"));
   }
 }