### Question:
CheckManifestInInstantRunMode extends AndroidVariantTask { @VisibleForTesting static void runManifestChangeVerifier( InstantRunBuildContext buildContext, File instantRunSupportDir, @NonNull File manifestFileToPackage) throws IOException { File previousManifestFile = new File(instantRunSupportDir, "manifest.xml"); if (previousManifestFile.exists()) { String currentManifest = Files.asCharSource(manifestFileToPackage, Charsets.UTF_8).read(); String previousManifest = Files.asCharSource(previousManifestFile, Charsets.UTF_8).read(); if (!currentManifest.equals(previousManifest)) { buildContext.setVerifierStatus( InstantRunVerifierStatus.MANIFEST_FILE_CHANGE); Files.copy(manifestFileToPackage, previousManifestFile); } } else { Files.createParentDirs(previousManifestFile); Files.copy(manifestFileToPackage, previousManifestFile); buildContext.setVerifierStatus(InstantRunVerifierStatus.INITIAL_BUILD); } }  @Input InternalArtifactType getResourcesInputType(); @InputFiles Provider<Directory> getInstantRunManifests(); @InputFiles BuildableArtifact getProcessedRes(); @TaskAction void checkManifestChanges();  }### Answer:
@Test public void runManifestChangeVerifier() throws IOException { File instantRunSupportDir = new File(mTemporaryFolder.newFolder(), "instant-run-support/debug"); File manifestFileToPackage = mTemporaryFolder.newFile(); { InstantRunBuildContext context = mock(InstantRunBuildContext.class); Files.asCharSink(manifestFileToPackage, Charsets.UTF_8).write("Original Manifest"); CheckManifestInInstantRunMode.runManifestChangeVerifier( context, instantRunSupportDir, manifestFileToPackage); verify(context).setVerifierStatus(InstantRunVerifierStatus.INITIAL_BUILD); } { InstantRunBuildContext context = mock(InstantRunBuildContext.class); Files.asCharSink(manifestFileToPackage, Charsets.UTF_8).write("Original Manifest"); CheckManifestInInstantRunMode.runManifestChangeVerifier( context, instantRunSupportDir, manifestFileToPackage); verifyNoMoreInteractions(context); } { InstantRunBuildContext context = mock(InstantRunBuildContext.class); Files.asCharSink(manifestFileToPackage, Charsets.UTF_8).write("Changed Manifest"); CheckManifestInInstantRunMode.runManifestChangeVerifier( context, instantRunSupportDir, manifestFileToPackage); verify(context).setVerifierStatus(InstantRunVerifierStatus.MANIFEST_FILE_CHANGE); } { InstantRunBuildContext context = mock(InstantRunBuildContext.class); Files.asCharSink(manifestFileToPackage, Charsets.UTF_8).write("Changed Manifest"); CheckManifestInInstantRunMode.runManifestChangeVerifier( context, instantRunSupportDir, manifestFileToPackage); verifyNoMoreInteractions(context); } }