### Question:
RenormalizeByEsLookedUpValuesTask extends Task { protected void performHitProcessing(Client client, BulkRequestBuilder brb, SearchHit hit) { Map<String, Object> content = hit.getSource(); String id = hit.getId(); String sysContentType = (String) content.get(ContentObjectFields.SYS_CONTENT_TYPE); ProviderContentTypeInfo typeDef = providerService.findContentType(sysContentType); if (typeDef == null) { writeTaskLog("No type definition found for document id=" + id + " so is skipped"); } else { try { providerService.runPreprocessors(sysContentType, ProviderService.extractPreprocessors(typeDef, sysContentType), content); } catch (PreprocessorInvalidDataException e) { writeTaskLog("ERROR: Data error from preprocessors execution so document " + id + " is skipped: " + e.getMessage()); return; } brb.add(client.prepareIndex(ProviderService.extractIndexName(typeDef, sysContentType), ProviderService.extractIndexType(typeDef, sysContentType), id).setSource(content)); } } RenormalizeByEsLookedUpValuesTask(ProviderService providerService, SearchClientService searchClientService,
			String lookupIndex, String lookupType, String lookupField, String[] esValues); protected  RenormalizeByEsLookedUpValuesTask(); @Override void performTask();  }### Answer:
@SuppressWarnings("unchecked") @Test public void performHitProcessing_PreprocessorInvalidDataException() throws Exception { RenormalizeByEsLookedUpValuesTask tested = new RenormalizeByEsLookedUpValuesTask(); tested.providerService = Mockito.mock(ProviderService.class); TaskExecutionContext context = Mockito.mock(TaskExecutionContext.class); tested.setExecutionContext("tid", context); List<Map<String, Object>> preprocessorsDef = new ArrayList<Map<String, Object>>(); configProviderServiceMock(tested, preprocessorsDef); SearchHit hit = Mockito.mock(SearchHit.class); BulkRequestBuilder brb = Mockito.mock(BulkRequestBuilder.class); Client client = Mockito.mock(Client.class); Mockito.when(hit.getId()).thenReturn("hitid"); Map<String, Object> content = new HashMap<String, Object>(); content.put(ContentObjectFields.SYS_CONTENT_TYPE, sysContentType); Mockito.when(hit.getSource()).thenReturn(content); Mockito.when( tested.providerService.runPreprocessors(Mockito.eq(sysContentType), Mockito.anyList(), Mockito.anyMap())) .thenThrow(new PreprocessorInvalidDataException(new InvalidDataException("data error"))); tested.performHitProcessing(client, brb, hit); Mockito.verify(context).writeTaskLog("tid", "ERROR: Data error from preprocessors execution so document hitid is skipped: data error"); Mockito.verifyNoMoreInteractions(context, brb, client); }