Exemple #1
0
 public boolean isValid(TextView tv) {
   Iterator i$ = this.mValidators.iterator();
   while (i$.hasNext()) {
     AbstractValidator v = (AbstractValidator) i$.next();
     if (!v.isValid(tv)) {
       this.mErrorMessage = v.getErrorMessage();
       return false;
     }
   }
   return true;
 }
  @Test
  public void test() {
    List<Message> messages;
    assertEquals(0, validator.getMessages().size());

    validator.validate(ClassAvailable.class.getCanonicalName());
    assertEquals(0, validator.getMessages().size());

    validator.validate("java.lang.String");
    assertEquals(0, validator.getMessages().size());

    validator.validate("net.jarcec.super.private.project.Main");
    assertEquals(1, validator.getMessages().size());
    messages = validator.getMessages();
    assertEquals(Status.ERROR, messages.get(0).getStatus());

    validator.validate(null);
    assertEquals(2, validator.getMessages().size());
    messages = validator.getMessages();
    assertEquals(Status.ERROR, messages.get(1).getStatus());
  }