/** Test the built-in conversion for those renderers that have it. */
  public void testEmptyStrings() {
    UIViewRoot root = Util.getViewHandler(getFacesContext()).createView(getFacesContext(), null);
    root.setLocale(Locale.US);
    UIInput text = new UIInput(), hidden = new UIInput(), secret = new UIInput();

    text.setId("text");
    hidden.setId("hidden");
    secret.setId("secret");

    text.setRendererType("Text");
    hidden.setRendererType("Hidden");
    secret.setRendererType("Secret");

    root.getChildren().add(text);
    root.getChildren().add(hidden);
    root.getChildren().add(secret);
    TextRenderer textRenderer = new TextRenderer();
    HiddenRenderer hiddenRenderer = new HiddenRenderer();
    SecretRenderer secretRenderer = new SecretRenderer();

    try {
      textRenderer.decode(getFacesContext(), text);
      hiddenRenderer.decode(getFacesContext(), hidden);
      secretRenderer.decode(getFacesContext(), secret);
    } catch (Throwable e) {
      assertTrue(false);
    }
    assertTrue(text.isValid());
    assertTrue(hidden.isValid());
    assertTrue(secret.isValid());
  }
  @SuppressWarnings({"UnusedParameters"})
  public void validateLogin(FacesContext context, UIComponent toValidate, Object login) {
    String loginStr = (String) login;
    UIInput valInput = (UIInput) toValidate;

    if (loginStr.trim().length() == 0) {
      FacesUtil.messageError("login", "Небходимо ввести имя пользователя.", null);
      valInput.setValid(false);
    } else if (!usersService.isLoginRegistered(loginStr)) {
      FacesUtil.messageError(
          "login", "Пользователь " + login + " не зарегистрирован в системе", null);
      valInput.setValid(false);
    }

    if (!valInput.isValid()) {
      effect.setFired(false);
    }
  }