mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2026-01-14 05:41:12 +00:00
Tidy up compiler warnings
This commit is contained in:
parent
14ef611d70
commit
cf35266336
6 changed files with 24 additions and 41 deletions
|
|
@ -1,7 +1,5 @@
|
|||
package org.springframework.samples.petclinic.model;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
|
||||
|
|
@ -9,13 +7,15 @@ import javax.validation.ConstraintViolation;
|
|||
import javax.validation.Validator;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.context.i18n.LocaleContextHolder;
|
||||
import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
/**
|
||||
* @author Michael Isvy
|
||||
* Simple test to make sure that Bean Validation is working
|
||||
* (useful when upgrading to a new version of Hibernate Validator/ Bean Validation)
|
||||
* @author Michael Isvy Simple test to make sure that Bean Validation is working (useful
|
||||
* when upgrading to a new version of Hibernate Validator/ Bean Validation)
|
||||
*/
|
||||
public class ValidatorTests {
|
||||
|
||||
|
|
@ -34,12 +34,13 @@ public class ValidatorTests {
|
|||
person.setLastName("smith");
|
||||
|
||||
Validator validator = createValidator();
|
||||
Set<ConstraintViolation<Person>> constraintViolations = validator.validate(person);
|
||||
Set<ConstraintViolation<Person>> constraintViolations = validator
|
||||
.validate(person);
|
||||
|
||||
assertThat(constraintViolations.size()).isEqualTo(1);
|
||||
ConstraintViolation<Person> violation = constraintViolations.iterator().next();
|
||||
assertThat(violation.getPropertyPath().toString()).isEqualTo("firstName");
|
||||
assertThat(violation.getMessage()).isEqualTo("may not be empty");
|
||||
assertThat(violation.getMessage()).isEqualTo("must not be empty");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
package org.springframework.samples.petclinic.owner;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
|
@ -13,10 +11,9 @@ import org.junit.Test;
|
|||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.Mockito;
|
||||
import org.mockito.runners.MockitoJUnitRunner;
|
||||
import org.springframework.samples.petclinic.owner.PetRepository;
|
||||
import org.springframework.samples.petclinic.owner.PetType;
|
||||
import org.springframework.samples.petclinic.owner.PetTypeFormatter;
|
||||
import org.mockito.junit.MockitoJUnitRunner;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
/**
|
||||
* Test class for {@link PetTypeFormatter}
|
||||
|
|
@ -64,12 +61,12 @@ public class PetTypeFormatterTests {
|
|||
*/
|
||||
private List<PetType> makePetTypes() {
|
||||
List<PetType> petTypes = new ArrayList<>();
|
||||
petTypes.add(new PetType(){
|
||||
petTypes.add(new PetType() {
|
||||
{
|
||||
setName("Dog");
|
||||
}
|
||||
});
|
||||
petTypes.add(new PetType(){
|
||||
petTypes.add(new PetType() {
|
||||
{
|
||||
setName("Bird");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue