### Question:
CheckManifestInInstantRunMode extends AndroidVariantTask { @VisibleForTesting static void runManifestBinaryChangeVerifier( InstantRunBuildContext buildContext, File instantRunSupportDir, @NonNull File resOutBaseNameFile) throws IOException { String currentIterationCRC = null; try (JarFile jarFile = new JarFile(resOutBaseNameFile)) { ZipEntry entry = jarFile.getEntry(SdkConstants.ANDROID_MANIFEST_XML); if (entry != null) { currentIterationCRC = String.valueOf(entry.getCrc()); } } File crcFile = new File(instantRunSupportDir, "manifest.crc"); if (crcFile.exists() && currentIterationCRC != null) { String previousIterationCRC = Files.asCharSource(crcFile, Charsets.UTF_8).readFirstLine(); if (!currentIterationCRC.equals(previousIterationCRC)) { buildContext.setVerifierStatus( InstantRunVerifierStatus.BINARY_MANIFEST_FILE_CHANGE); } } else { buildContext.setVerifierStatus(InstantRunVerifierStatus.INITIAL_BUILD); } if (currentIterationCRC != null) { Files.createParentDirs(crcFile); Files.asCharSink(crcFile, Charsets.UTF_8).write(currentIterationCRC); } }  @Input InternalArtifactType getResourcesInputType(); @InputFiles Provider<Directory> getInstantRunManifests(); @InputFiles BuildableArtifact getProcessedRes(); @TaskAction void checkManifestChanges();  }### Answer:
@Test public void runManifestBinaryChangeVerifier() throws IOException { File instantRunSupportDir = new File(mTemporaryFolder.newFolder(), "instant-run-support/debug"); File resOutBaseNameFile = mTemporaryFolder.newFile(); writeManifestFile(resOutBaseNameFile, "Initial binary manifest"); { InstantRunBuildContext context = mock(InstantRunBuildContext.class); CheckManifestInInstantRunMode.runManifestBinaryChangeVerifier( context, instantRunSupportDir, resOutBaseNameFile); verify(context).setVerifierStatus(InstantRunVerifierStatus.INITIAL_BUILD); } { InstantRunBuildContext context = mock(InstantRunBuildContext.class); writeManifestFile(resOutBaseNameFile, "Initial binary manifest"); CheckManifestInInstantRunMode.runManifestBinaryChangeVerifier( context, instantRunSupportDir, resOutBaseNameFile); verifyNoMoreInteractions(context); } { InstantRunBuildContext context = mock(InstantRunBuildContext.class); writeManifestFile(resOutBaseNameFile, "Changed binary manifest"); CheckManifestInInstantRunMode.runManifestBinaryChangeVerifier( context, instantRunSupportDir, resOutBaseNameFile); verify(context).setVerifierStatus( InstantRunVerifierStatus.BINARY_MANIFEST_FILE_CHANGE); } { InstantRunBuildContext context = mock(InstantRunBuildContext.class); writeManifestFile(resOutBaseNameFile, "Changed binary manifest"); CheckManifestInInstantRunMode.runManifestBinaryChangeVerifier( context, instantRunSupportDir, resOutBaseNameFile); verifyNoMoreInteractions(context); } }