### Question:
NormalizationRestService extends RestServiceBase { @GET @Path("/{normalizationName}/{id}") @Produces(MediaType.APPLICATION_JSON) public Object normalizeOne(@PathParam("normalizationName") String normalizationName, @PathParam(INKEY_ID) String id) throws ObjectNotFoundException { if (SearchUtils.isBlank(normalizationName)) { throw new RequiredFieldException("normalizationName"); } if (SearchUtils.isBlank(id)) { throw new RequiredFieldException(INKEY_ID); } List<StructuredContentPreprocessor> preprocessors = getPreprocessors(normalizationName); return runPreprocessors(preprocessors, id); }  @SuppressWarnings("unchecked") @GET @Path("/") @Produces(MediaType.APPLICATION_JSON) Map<String, Object> availableNormalizations(); @GET @Path("/{normalizationName}/{id}") @Produces(MediaType.APPLICATION_JSON) Object normalizeOne(@PathParam("normalizationName") String normalizationName, @PathParam(INKEY_ID) String id); @GET @Path("/{normalizationName}") @Produces(MediaType.APPLICATION_JSON) Object normalizeBulk(@PathParam("normalizationName") String normalizationName, @Context UriInfo uriInfo); @SuppressWarnings("unchecked") List<StructuredContentPreprocessor> getPreprocessors(String normalizationName); Map<String, Object> runPreprocessors(List<StructuredContentPreprocessor> preprocessors, String id); static final String INKEY_ID; static final String CFG_PREPROCESSORS; static final String CFG_DESCRIPTION; static final String OUTKEY_WARNINGS; static final String OUTKEY_INPUT_ID; }### Answer:
@Test public void normalizeOne() throws Exception { NormalizationRestService tested = Mockito.mock(NormalizationRestService.class); Mockito.when(tested.normalizeOne(Mockito.anyString(), Mockito.anyString())).thenCallRealMethod(); try { tested.normalizeOne(null, "id"); Assert.fail("RequiredFieldException expected"); } catch (RequiredFieldException e) { } try { tested.normalizeOne(" ", "id"); Assert.fail("RequiredFieldException expected"); } catch (RequiredFieldException e) { } try { tested.normalizeOne(TEST_NORM_NAME, null); Assert.fail("RequiredFieldException expected"); } catch (RequiredFieldException e) { } try { tested.normalizeOne(TEST_NORM_NAME, " "); Assert.fail("RequiredFieldException expected"); } catch (RequiredFieldException e) { } List<StructuredContentPreprocessor> pl = new ArrayList<>(); Mockito.when(tested.getPreprocessors(TEST_NORM_NAME)).thenReturn(pl); Map<String, Object> ret = new HashMap<>(); Mockito.when(tested.runPreprocessors(pl, "myid")).thenReturn(ret); Assert.assertEquals(ret, tested.normalizeOne(TEST_NORM_NAME, "myid")); }