ConstraintServices { ConstraintViolation extractViolation(javax.validation.ConstraintViolation<?> constraintViolation) { ConstraintViolation cv = new ConstraintViolation(constraintViolation.getMessage()); extractViolationInfoFromNodes(constraintViolation.getPropertyPath().iterator(), cv); cv.setName(getArgumentName(cv)); return cv; }  ConstraintViolation[] extractViolations(ConstraintViolationException cve);  }
@Test public void testExtractViolation() { System.out.println("extractViolation"); doNothing().when(instance).extractViolationInfoFromNodes(any(Iterator.class), any(ConstraintViolation.class)); doReturn("NAME").when(instance).getArgumentName(any(ConstraintViolation.class)); javax.validation.ConstraintViolation cv = mock(javax.validation.ConstraintViolation.class); Path path = mock(Path.class); when(cv.getPropertyPath()).thenReturn(path); when(path.iterator()).thenReturn(mock(Iterator.class)); ConstraintViolation result = instance.extractViolation(cv); assertThat(result.getName()).isEqualTo("NAME"); }