List of usage examples for org.springframework.validation Errors hasFieldErrors
boolean hasFieldErrors(String field);
From source file:org.codeqinvest.web.project.CodeChangeSettingsValidatorTest.java
@Test public void daysMustNotBeNegative() { CodeChangeSettings settings = CodeChangeSettings.defaultSetting(-1); Errors errors = validateSettings(settings); assertThat(errors.hasFieldErrors("days")).isTrue(); }
From source file:org.codeqinvest.web.sonar.SonarServerValidatorTest.java
@Test public void urlShouldBeMandatory() { SonarServer server = new SonarServer(""); Errors errors = validateSonarServer(server); assertThat(errors.hasFieldErrors("url")).isTrue(); }
From source file:org.codeqinvest.web.sonar.SonarServerValidatorTest.java
@Test public void urlShouldBeValidUrl() { SonarServer server = new SonarServer("localhost"); Errors errors = validateSonarServer(server); assertThat(errors.hasFieldErrors("url")).isTrue(); }
From source file:org.codeqinvest.web.project.ScmConnectionSettingsValidatorTest.java
@Test public void urlShouldBeMandatory() { ScmConnectionSettings settings = new ScmConnectionSettings(""); Errors errors = validateSettings(settings); assertThat(errors.hasFieldErrors("url")).isTrue(); }
From source file:org.codeqinvest.web.project.ScmConnectionSettingsValidatorTest.java
@Test public void typeShouldBeSupported() { ScmConnectionSettings settings = new ScmConnectionSettings("scm:svn:http://localhost"); settings.setType(-1);// ww w. j a v a 2 s . c o m Errors errors = validateSettings(settings); assertThat(errors.hasFieldErrors("type")).isTrue(); }
From source file:org.codeqinvest.web.project.SonarConnectionSettingsValidatorTest.java
@Test public void urlShouldBeMandatory() { SonarConnectionSettings settings = new SonarConnectionSettings(""); Errors errors = validateSettings(settings); assertThat(errors.hasFieldErrors("url")).isTrue(); }
From source file:org.codeqinvest.web.project.SonarConnectionSettingsValidatorTest.java
@Test public void urlShouldBeValidUrl() { SonarConnectionSettings settings = new SonarConnectionSettings("locahost"); Errors errors = validateSettings(settings); assertThat(errors.hasFieldErrors("url")).isTrue(); }
From source file:org.codeqinvest.web.project.SonarConnectionSettingsValidatorTest.java
@Test public void projectShouldBeMandatory() { SonarConnectionSettings settings = new SonarConnectionSettings("http://localhost", " "); Errors errors = validateSettings(settings); assertThat(errors.hasFieldErrors("project")).isTrue(); }
From source file:com.springsource.hq.plugin.tcserver.serverconfig.resources.jdbc.General.java
public void validate(Object target, Errors errors) { General general = (General) target;//w ww.jav a 2s . c o m if (!errors.hasFieldErrors("jndiName")) { if (!StringUtils.hasText(general.getJndiName())) { errors.rejectValue("jndiName", "resource.dataSource.general.jndiName.required"); } else { if (general.parent() != null) { // detect duplicate jndi names for (DataSource dataSource : general.parent().parent().getDataSources()) { General g = dataSource.getGeneral(); if (g != general && ObjectUtils.nullSafeEquals(general.getJndiName(), g.getJndiName())) { errors.reject("resource.dataSource.general.jndiName.unique", new Object[] { general.getJndiName() }, null); } } } } } }
From source file:org.codeqinvest.web.project.ProjectConnectionsValidatorTest.java
@Test public void shouldFailWhenSonarProjectIsNotReachable() { when(sonarConnectionCheckerService.isReachable(any(SonarConnectionSettings.class))).thenReturn(false); mockAvailableScmSystem();/*w ww . ja va 2 s.c om*/ Errors errors = validateProject(project); assertThat(errors.hasFieldErrors("sonarConnectionSettings")).isTrue(); }