### Question:
RequestIdentifier { public static boolean isIndexRequest(@NonNull Request esRequest) { String[] pathFields = esRequest.getEndpoint().substring(1).split("/"); return (pathFields.length == Constants.INDEX_PATH_LENGTH || pathFields.length == Constants.INDEX_PATH_LENGTH_WITHOUT_ID) && !Constants.SEARCH_REQUEST.equals(pathFields[1]) && pathFields[0].matches(Constants.INDEX_REGEX); }  static boolean isConfigRequest(@NonNull Request esRequest); static boolean isConfigUpdateRequest(@NonNull Request esRequest); static boolean isMutationRequest(@NonNull Request esRequest); static boolean isIndexRequest(@NonNull Request esRequest); static boolean isBulkRequest(@NonNull Request esRequest); static String getIndexName(@NonNull Request esRequest); static Optional<String> getBulkIndexName(@NonNull String payloadLine);  }### Answer:
@Test public void succeedIsIndexRequestWithCorrectIndexPattern() { esRequest = new Request(TestConstants.POST_METHOD, TestConstants.CORRECT_INDEX_PATH); boolean result = RequestIdentifier.isIndexRequest(esRequest); assertTrue(result); }
@Test public void failedIsIndexRequestWithWrongPath() { esRequest = new Request(TestConstants.PUT_METHOD, TestConstants.WRONG_INDEX_PATH); boolean result = RequestIdentifier.isIndexRequest(esRequest); assertFalse(result); }
@Test public void failedIsIndexRequestWithImproperIndex() { esRequest = new Request(TestConstants.PUT_METHOD, TestConstants.WRONG_INDEX_PATTERN); boolean result = RequestIdentifier.isIndexRequest(esRequest); assertFalse(result); }