### Question:
EnsureOakIndexJobHandler implements Runnable { public Resource create(final @Nonnull Resource ensuredDefinition, final @Nonnull Resource oakIndexes) throws RepositoryException { final Node oakIndex = JcrUtil.copy( ensuredDefinition.adaptTo(Node.class), oakIndexes.adaptTo(Node.class), ensuredDefinition.getName()); oakIndex.setPrimaryType(NT_OAK_QUERY_INDEX_DEFINITION); oakIndex.setProperty(JcrConstants.JCR_CREATED, Calendar.getInstance()); oakIndex.setProperty(JcrConstants.JCR_CREATED_BY, ENSURE_OAK_INDEX_USER_NAME); log.info("Created Oak Index at [ {} ] with Ensure Definition [ {} ]", oakIndex.getPath(), ensuredDefinition.getPath()); return ensuredDefinition.getResourceResolver().getResource(oakIndex.getPath()); } EnsureOakIndexJobHandler(EnsureOakIndex ensureOakIndex, String oakIndexPath, String ensureDefinitionsPath); @Override @SuppressWarnings("squid:S1141") void run(); void forceRefresh(final @Nonnull Resource oakIndex); Resource create(final @Nonnull Resource ensuredDefinition, final @Nonnull Resource oakIndexes); @SuppressWarnings("squid:S3776") Resource update(final @Nonnull Resource ensureDefinition, final @Nonnull Resource oakIndexes, boolean forceReindex); void disableIndex(@Nonnull Resource oakIndex); void delete(final @Nonnull Resource oakIndex); void validateEnsureDefinition(@Nonnull Resource ensureDefinition);  }### Answer:
@Test public void testCreate() { context.build().resource(ENSURE_INDEX_PATH, ensureIndexProperties).commit(); handler.run(); Resource indexResource = context.resourceResolver().getResource(OAK_INDEX_PATH); assertNotNull(indexResource); ValueMap vm = indexResource.adaptTo(ValueMap.class); assertNotNull(vm); assertEquals("newProp",vm.get("propertyNames",String.class)); assertEquals("1",vm.get("reindexCount",String.class)); }