@Test public void testGetValueFromDataArray() throws Exception { assertEquals(USERNAME, getValueFromDataArray(mapper.readTree(JSON_ARRAY), USERNAME)); assertEquals(PASSWORD, getValueFromDataArray(mapper.readTree(JSON_ARRAY), PASSWORD)); assertEquals(EMPTY, getValueFromDataArray(mapper.readTree(JSON_ARRAY), INVALID_KEY)); }
@NotNull public static String getValueFromDataArray(@NotNull final JsonNode dataArray, @NotNull final String keyName) { if (dataArray.isArray()) { for (final JsonNode nodeElement : dataArray) { if (nodeElement.get(KEY).asText(EMPTY).equalsIgnoreCase(keyName)) { return nodeElement.get(VALUE).asText(EMPTY); } } } return EMPTY; }
GetCredentialFromManagerController { @NotNull public static String getValueFromDataArray(@NotNull final JsonNode dataArray, @NotNull final String keyName) { if (dataArray.isArray()) { for (final JsonNode nodeElement : dataArray) { if (nodeElement.get(KEY).asText(EMPTY).equalsIgnoreCase(keyName)) { return nodeElement.get(VALUE).asText(EMPTY); } } } return EMPTY; } }
GetCredentialFromManagerController { @NotNull public static String getValueFromDataArray(@NotNull final JsonNode dataArray, @NotNull final String keyName) { if (dataArray.isArray()) { for (final JsonNode nodeElement : dataArray) { if (nodeElement.get(KEY).asText(EMPTY).equalsIgnoreCase(keyName)) { return nodeElement.get(VALUE).asText(EMPTY); } } } return EMPTY; }  }
GetCredentialFromManagerController { @NotNull public static String getValueFromDataArray(@NotNull final JsonNode dataArray, @NotNull final String keyName) { if (dataArray.isArray()) { for (final JsonNode nodeElement : dataArray) { if (nodeElement.get(KEY).asText(EMPTY).equalsIgnoreCase(keyName)) { return nodeElement.get(VALUE).asText(EMPTY); } } } return EMPTY; }  @NotNull static String getUsernameFromDataArray(@NotNull final JsonNode dataArray); @NotNull static String getPasswordFromDataArray(@NotNull final JsonNode dataArray); @NotNull static String getValueFromDataArray(@NotNull final JsonNode dataArray, @NotNull final String keyName); }
GetCredentialFromManagerController { @NotNull public static String getValueFromDataArray(@NotNull final JsonNode dataArray, @NotNull final String keyName) { if (dataArray.isArray()) { for (final JsonNode nodeElement : dataArray) { if (nodeElement.get(KEY).asText(EMPTY).equalsIgnoreCase(keyName)) { return nodeElement.get(VALUE).asText(EMPTY); } } } return EMPTY; }  @NotNull static String getUsernameFromDataArray(@NotNull final JsonNode dataArray); @NotNull static String getPasswordFromDataArray(@NotNull final JsonNode dataArray); @NotNull static String getValueFromDataArray(@NotNull final JsonNode dataArray, @NotNull final String keyName);  }