### Question:
JsonValues { public static JsonValue getWithDeprecation(JsonValue config, Logger logger, String name, String... deprecatedNames) { String found = config.isDefined(name) ? name : null; for (String deprecatedName : deprecatedNames) { if (config.isDefined(deprecatedName)) { if (found == null) { found = deprecatedName; warnForDeprecation(config, logger, name, found); } else { logger.warning("Cannot use both '" + deprecatedName + "' and '" + found + "' attributes, " + "will use configuration from '" + found + "' attribute"); break; } } } return found == null ? config.get(name) : config.get(found); } private  JsonValues(); static Class<?> asClass(JsonValue value); @SuppressWarnings("unchecked") static T asNewInstance(JsonValue value, Class<T> type); static Expression<T> asExpression(JsonValue value, Class<T> expectedType); static String evaluate(JsonValue value); static JsonValue evaluate(final JsonValue value, final Logger logger); static JsonValue evaluateJsonStaticExpression(final JsonValue value); static JsonValue firstOf(final JsonValue config, final String... names); static Function<JsonValue, Expression<String>, HeapException> ofExpression(); static Function<JsonValue, T, HeapException> ofRequiredHeapObject(final Heap heap,
                                                                                 final Class<T> type); static Function<JsonValue, T, HeapException> ofEnum(final Class<T> enumType); static JsonValue getWithDeprecation(JsonValue config, Logger logger, String name,
            String... deprecatedNames); static void warnForDeprecation(final JsonValue config, final Logger logger,
            final String name, final String deprecatedName);  }### Answer:
@Test public void getWithDeprecationReturnsNonDeprecatedValue() { JsonValue config = json(object(field("new", "value"))); assertThat(getWithDeprecation(config, logger, "new", "old").asString()).isEqualTo("value"); verifyZeroInteractions(logger); }
@Test public void getWithDeprecationReturnsNullValue() { JsonValue config = json(object(field("new", "value"))); assertThat(getWithDeprecation(config, logger, "missing", "old").asString()).isNull(); verifyZeroInteractions(logger); }
@Test public void getWithDeprecationReturnsDeprecatedValue1() { JsonValue config = json(object(field("old", "value"))); assertThat(getWithDeprecation(config, logger, "new", "old").asString()).isEqualTo("value"); verify(logger).warning(anyString()); }
@Test public void getWithDeprecationReturnsDeprecatedValue2() { JsonValue config = json(object(field("older", "value"))); assertThat(getWithDeprecation(config, logger, "new", "old", "older").asString()).isEqualTo( "value"); verify(logger).warning(anyString()); }
@Test public void getWithDeprecationReturnsMostRecentValue1() { JsonValue config = json(object(field("new", "value1"), field("old", "value2"))); assertThat(getWithDeprecation(config, logger, "new", "old", "older").asString()).isEqualTo( "value1"); verify(logger).warning(anyString()); }
@Test public void getWithDeprecationReturnsMostRecentValue2() { JsonValue config = json(object(field("old", "value1"), field("older", "value2"))); assertThat(getWithDeprecation(config, logger, "new", "old", "older").asString()).isEqualTo( "value1"); verify(logger, times(2)).warning(anyString()); }