FileCache { @Override public String toString() { return MoreObjects.toStringHelper(this) .add("cacheDirectory", mCacheDirectory) .add("interProcessLocking", mInterProcessLocking) .toString(); } private  FileCache(); private  FileCache(@NonNull File cacheDirectory, boolean interProcessLocking); @NonNull static FileCache withInterProcessLocking(@NonNull File cacheDirectory); @NonNull static FileCache withSingleProcessLocking(@NonNull File cacheDirectory); boolean getOrCreateFile(
            @NonNull File outputFile,
            @NonNull Inputs inputs,
            @NonNull IOExceptionFunction<File, Void> fileProducer); @Override String toString(); static final FileCache NO_CACHE; }
@Test public void testInputsGetKey() { File inputFile = new File( "/Users/foo/Android/Sdk/extras/android/m2repository/com/android/support/" + "support-annotations/23.3.0/support-annotations-23.3.0.jar"); FileCache.Inputs inputs = new FileCache.Inputs.Builder() .put("file", inputFile) .put("buildToolsRevision", Revision.parseRevision("23.0.3").toString()) .put("jumboMode", true) .put("optimize", false) .put("multiDex", true) .put("classpath", new File("foo")) .build(); assertThat(inputs.toString()) .isEqualTo( Joiner.on(System.lineSeparator()) .join( "file=" + inputFile.getPath(), "buildToolsRevision=23.0.3", "jumboMode=true", "optimize=false", "multiDex=true", "classpath=foo")); assertThat(inputs.getKey()).matches("\\w{40}"); inputFile = new File("com.android.support/design/23.3.0/jars/classes.jar"); inputs = new FileCache.Inputs.Builder().put("file", inputFile).build(); assertThat(inputs.toString()).isEqualTo("file=" + inputFile.getPath()); assertThat(inputs.getKey()).isEqualTo("25dcc2247956f01b9dbdca420eff87c96aaf2874"); inputFile = new File( "C:\\Users\\foo\\Android\\Sdk\\extras\\android\\m2repository\\" + "com\\android\\support\\support-annotations\\23.3.0\\" + "support-annotations-23.3.0.jar"); inputs = new FileCache.Inputs.Builder().put("file", inputFile).build(); assertThat(inputs.toString()).isEqualTo("file=" + inputFile.getPath()); assertThat(inputs.getKey()).isEqualTo("d78d98a050e19057d83ad84ddebde43e2f8e67d7"); inputFile = new File("foo`-=[]\\\\;',./~!@#$%^&*()_+{}|:\\\"<>?"); inputs = new FileCache.Inputs.Builder().put("file", inputFile).build(); assertThat(inputs.toString()).isEqualTo("file=" + inputFile.getPath()); assertThat(inputs.getKey()).isEqualTo("7f205499565a454d0186f34313e63281c7192a43"); inputFile = new File(""); inputs = new FileCache.Inputs.Builder().put("file", inputFile).build(); assertThat(inputs.toString()).isEqualTo("file="); assertThat(inputs.getKey()).isEqualTo("3fe9ece2d6113d8db5c0c5576cc1378823d839ab"); try { new FileCache.Inputs.Builder().build(); fail("expected IllegalStateException"); } catch (IllegalStateException exception) { assertThat(exception).hasMessage("Inputs must not be empty."); } inputs = new FileCache.Inputs.Builder().put("arg", "true").put("arg", "false").build(); assertThat(inputs.toString()).isEqualTo("arg=false"); inputs = new FileCache.Inputs.Builder().put("arg", "true").put("arg", false).build(); assertThat(inputs.toString()).isEqualTo("arg=false"); inputs = new FileCache.Inputs.Builder() .put("arg1", "true") .put("arg2", "true") .put("arg1", "false") .build(); assertThat(inputs.toString()) .isEqualTo("arg1=false" + System.lineSeparator() + "arg2=true"); }