### Question:
CmakeAndroidNinjaExternalNativeJsonGenerator extends CmakeExternalNativeJsonGenerator { @NonNull @Override List<String> getCacheArguments(@NonNull JsonGenerationAbiConfiguration abiConfig) { List<String> cacheArguments = getCommonCacheArguments(abiConfig); cacheArguments.add( String.format("-DCMAKE_TOOLCHAIN_FILE=%s", getToolChainFile().getAbsolutePath())); cacheArguments.add( String.format("-DCMAKE_MAKE_PROGRAM=%s", getNinjaExecutable().getAbsolutePath())); cacheArguments.add("-GAndroid Gradle - Ninja"); return cacheArguments; } CmakeAndroidNinjaExternalNativeJsonGenerator(
            @NonNull JsonGenerationVariantConfiguration config,
            @NonNull Set<String> configurationFailures,
            @NonNull AndroidBuilder androidBuilder,
            @NonNull File cmakeInstallFolder,
            @NonNull GradleBuildVariant.Builder stats); @NonNull @Override String executeProcessAndGetOutput(@NonNull JsonGenerationAbiConfiguration abiConfig);  }### Answer:
@Test public void testGetCacheArguments() { JsonGenerationVariantConfiguration config = new JsonGenerationVariantConfiguration( new File("."), new NativeBuildSystemVariantConfig( new HashSet<>(), new HashSet<>(), buildArguments, cFlags, cppFlags), variantName, makeFile, sdkFolder, ndkFolder, soFolder, objFolder, jsonFolder, debuggable, abis, Revision.parseRevision("15"), nativeBuildConfigurationsJsons, new File("./compiler-settings-cache"), true); Mockito.when(androidBuilder.getLogger()).thenReturn(logger); Mockito.when(androidBuilder.getIssueReporter()).thenReturn(issueReporter); CmakeAndroidNinjaExternalNativeJsonGenerator cmakeAndroidNinjaStrategy = new CmakeAndroidNinjaExternalNativeJsonGenerator( config, new HashSet<>(), androidBuilder, cmakeFolder, stats); JsonGenerationAbiConfiguration abiConfig = createJsonGenerationAbiConfiguration( Abi.X86, "debug", jsonFolder, objFolder, NativeBuildSystem.CMAKE, 12); List<String> cacheArguments = cmakeAndroidNinjaStrategy.getProcessBuilderArgs(abiConfig); assertThat(cacheArguments).isNotEmpty(); assertThat(cacheArguments) .contains( String.format( "-DANDROID_NDK=%s", cmakeAndroidNinjaStrategy.getNdkFolder())); assertThat(cacheArguments).contains("-DCMAKE_BUILD_TYPE=Debug"); assertThat(cacheArguments).contains("-DCMAKE_C_FLAGS=c-flags1 c-flag2"); assertThat(cacheArguments).contains("-DCMAKE_CXX_FLAGS=cpp-flags1 cpp-flag2"); assertThat(cacheArguments).contains("-GAndroid Gradle - Ninja"); assertThat(cacheArguments).contains("build-argument-foo"); assertThat(cacheArguments).contains("build-argument-bar"); assertThat(cacheArguments).contains("build-argument-baz"); int indexOfSubset = Collections.indexOfSubList(cacheArguments, buildArguments); assertThat(cacheArguments.size() - indexOfSubset).isEqualTo(buildArguments.size()); assertThat(stats.getNativeBuildSystemType()) .isEqualTo(GradleNativeAndroidModule.NativeBuildSystemType.CMAKE); }