### Question:
CodeBaseFingerprint { public static Builder builder(AgentConfig config) { return new Builder(config); }  static Builder builder(AgentConfig config);  }### Answer:
@Test public void should_be_insensitive_to_file_order() { CodeBaseFingerprint fp1 = CodeBaseFingerprint.builder(config).record(files[1]).record(files[2]).build(); CodeBaseFingerprint fp2 = CodeBaseFingerprint.builder(config).record(files[2]).record(files[1]).build(); assertThat(fp1, equalTo(fp2)); assertThat(fp2, equalTo(fp1)); }
@Test public void should_include_last_modified_in_calculation() { CodeBaseFingerprint fp1 = CodeBaseFingerprint.builder(config).record(files[1]).build(); long now = 1492881351977L; files[1].setLastModified(now + 10); CodeBaseFingerprint fp2 = CodeBaseFingerprint.builder(config).record(files[1]).build(); assertThat(files[1].lastModified(), not(is(now))); assertThat(fp2, not(equalTo(fp1))); }
@Test public void should_include_length_in_calculation() { CodeBaseFingerprint fp1 = CodeBaseFingerprint.builder(config).record(files[1]).build(); writeFile(files[1], "foobar"); CodeBaseFingerprint fp2 = CodeBaseFingerprint.builder(config).record(files[1]).build(); assertThat(fp2, not(equalTo(fp1))); }
@Test public void should_include_packages_in_calculation() { CodeBaseFingerprint fp1 = CodeBaseFingerprint.builder(config).build(); CodeBaseFingerprint fp2 = CodeBaseFingerprint.builder( config.toBuilder().packages(config.getPackages() + "; some.more.packages").build()) .build(); assertThat(fp2, not(equalTo(fp1))); }
@Test public void should_include_exclude_packages_in_calculation() { CodeBaseFingerprint fp1 = CodeBaseFingerprint.builder(config).build(); CodeBaseFingerprint fp2 = CodeBaseFingerprint.builder( config.toBuilder() .excludePackages(config.getExcludePackages() + "; some.more.packages") .build()) .build(); assertThat(fp2, not(equalTo(fp1))); }
@Test public void should_include_method_visibility_in_calculation() { CodeBaseFingerprint fp1 = CodeBaseFingerprint.builder(config.toBuilder().methodVisibility("public").build()).build(); CodeBaseFingerprint fp2 = CodeBaseFingerprint.builder(config.toBuilder().methodVisibility("private").build()).build(); assertThat(fp2, not(equalTo(fp1))); }