### Question:
ProjectOptions { public boolean get(BooleanOption option) { return booleanOptions.getOrDefault(option, option.getDefaultValue()); } ProjectOptions(@NonNull ImmutableMap<String, Object> properties);  ProjectOptions(@NonNull Project project);  ProjectOptions(
            @NonNull Project project, @NonNull ImmutableMap<String, Object> overwrites); boolean get(BooleanOption option); @Nullable Boolean get(OptionalBooleanOption option); @Nullable Integer get(IntegerOption option); @Nullable String get(StringOption option); @NonNull Map<String, String> getExtraInstrumentationTestRunnerArgs(); @NonNull Set<OptionalCompilationStep> getOptionalCompilationSteps(); boolean hasRemovedOptions(); @NonNull String getRemovedOptionsErrorMessage(); ImmutableMap<BooleanOption, Boolean> getExplicitlySetBooleanOptions(); ImmutableMap<OptionalBooleanOption, Boolean> getExplicitlySetOptionalBooleanOptions(); ImmutableMap<IntegerOption, Integer> getExplicitlySetIntegerOptions(); ImmutableMap<StringOption, String> getExplicitlySetStringOptions(); boolean hasDeprecatedOptions(); ImmutableSet<Option<?>> getDeprecatedOptions(); ImmutableMap<Option<?>, String> getExperimentalOptions(); static final String PROPERTY_TEST_RUNNER_ARGS; }### Answer:
@Test public void booleanSanity() { assertThat(BooleanOption.IDE_INVOKED_FROM_IDE.getDefaultValue()).isFalse(); assertThat(new ProjectOptions(ImmutableMap.of()).get(BooleanOption.IDE_INVOKED_FROM_IDE)) .isFalse(); assertThat( new ProjectOptions( ImmutableMap.of( "android.injected.invoked.from.ide", "true")) .get(BooleanOption.IDE_INVOKED_FROM_IDE)) .isTrue(); assertThat( new ProjectOptions( ImmutableMap.of( "android.injected.invoked.from.ide", "false")) .get(BooleanOption.IDE_INVOKED_FROM_IDE)) .isFalse(); try { new ProjectOptions(ImmutableMap.of("android.injected.invoked.from.ide", "?")); fail("Expected IllegalArgumentException"); } catch (IllegalArgumentException expected) { assertThat(expected.getMessage()).contains("android.injected.invoked.from.ide"); } }
@Test public void integerSanity() { assertThat(IntegerOption.IDE_TARGET_DEVICE_API.getDefaultValue()).isNull(); assertThat(new ProjectOptions(ImmutableMap.of()).get(IntegerOption.IDE_TARGET_DEVICE_API)) .isNull(); assertThat(parseInteger("20")).isEqualTo(20); assertThat(parseInteger(21)).isEqualTo(21); assertThat(parseInteger(new Long(22))).isEqualTo(22); assertThat(parseInteger(asGroovyString(23))).isEqualTo(23); try { new ProjectOptions(ImmutableMap.of("android.injected.build.api", new Object())); fail("Expected IllegalArgumentException"); } catch (IllegalArgumentException expected) { assertThat(expected.getMessage()).contains("android.injected.build.api"); } }
@Test public void stringSanity() { assertThat(StringOption.IDE_BUILD_TARGET_ABI.getDefaultValue()).isNull(); assertThat(new ProjectOptions(ImmutableMap.of()).get(StringOption.IDE_BUILD_TARGET_ABI)) .isNull(); ProjectOptions options = new ProjectOptions( ImmutableMap.of("android.injected.build.abi", asGroovyString("x86"))); assertThat(options.get(StringOption.IDE_BUILD_TARGET_ABI)).isEqualTo("x86"); }