### Question:
MyServiceImpl implements MyService { @Override @ServiceValidation public DTO getDto (final DTO dto){ return dto; }  @Override @ServiceValidation DTO getDto(final DTO dto);  }### Answer:
@Test(expected = ServiceValidationException.class) public void shouldValidateWhenAttributeIsNull(){ myService.getDto(null); }
@Test(expected = ServiceValidationException.class) public void shouldValidateWhenModelIsInvalid(){ myService.getDto(new DTO()); }
@Test public void everythingFine(){ final DTO dto = new DTO(); dto.setNumber(1); dto.setText("test"); final DTO result = myService.getDto(dto); Assert.assertEquals(result.getNumber(), dto.getNumber()); Assert.assertEquals(result.getText(), dto.getText()); }