public void cadastrarTime(Time time) throws UsuarioCurtoException, UsuarioLongoException, UsuarioExistenteException, SenhaCurtaException, SenhaLongaException { boolean usuarioExistente = (Boolean) null; boolean nomeUsuarioJaExiste = (Boolean) null; if (time == null) { throw new IllegalArgumentException(); // o que fazer quando null? } else { if (Utilidades.nomeUsuarioNosConformes(time.getUsuario())) { } else { throw new UsuarioCurtoException(); } Utilidades.nomeNosConformes(time.getNome()); // chamar método nomeUsuarioNosConforme e senha tb. nomeUsuarioJaExiste = repositorioTime.verificarNomeUsuarioJaExiste(time.getUsuario()); if (usuarioExistente == false && nomeUsuarioJaExiste == false) { repositorioTime.cadastrarTime(time); } else if (usuarioExistente) { throw new UsuarioExistenteException(); } if (nomeUsuarioJaExiste) { throw new UsuarioExistenteException(); } } }