### Question:
IndexerRestService extends RestServiceBase { protected String extractIndexerName(Map<String, Object> ic, String contentType) throws ObjectNotFoundException { String indexerName = SearchUtils.trimToNull((String) ic.get(ProviderService.NAME)); if (indexerName == null) { throw new ObjectNotFoundException("Indexer name is not configured correctly for content type " + contentType); } return indexerName; }  @POST @Path("/{type}/_force_reindex") Response forceReindex(@PathParam("type") @AuditId String type); @POST @Path("/_all/_stop") Map<String, String> stopAll(); @POST @Path("/{type}/_stop") Response stop(@PathParam("type") @AuditId String type); @POST @Path("/_all/_restart") Map<String, String> restartAll(); @POST @Path("/{type}/_restart") Response restart(@PathParam("type") @AuditId String type); @GET @Path("/_all/_status") @AuditIgnore Map<String, Object> statusAll(); @GET @Path("/{type}/_status") @AuditIgnore Object getStatus(@PathParam("type") String type); static final String INDEXER_TYPE_ES_RIVER_REMOTE; static final String INDEXER_TYPE_ES_RIVER_JIRA; }### Answer:
@Test public void extractIndexerName() throws ObjectNotFoundException { IndexerRestService tested = getTested(); Map<String, Object> ic = new HashMap<>(); try { tested.extractIndexerName(ic, "type"); Assert.fail("ObjectNotFoundException expected"); } catch (ObjectNotFoundException e) { } ic.put(ProviderService.NAME, "myName"); Assert.assertEquals("myName", tested.extractIndexerName(ic, "type")); }