@Test public void calculateFingerprint_shouldReturnDifferentFingerprints_forDifferentThrowableTypes() throws Exception { String message = "foo"; Throwable a = new Exception(message); a.setStackTrace(constructCustomStackTrace()); Throwable b = new RuntimeException(message); b.setStackTrace(constructCustomStackTrace()); String fingerprintA = calculator.calculateFingerprint(a); String fingerprintB = calculator.calculateFingerprint(b); assertNotEquals(fingerprintA, fingerprintB); }
public String calculateFingerprint(Throwable t) { MessageDigest md5 = getMD5Instance(); PrintStream ps = new PrintStream(new DigestOutputStream(new DoNothingOutputStream(), md5)); t.printStackTrace(ps); return base64Encoder.encodeToString(md5.digest()); }
ThrowableFingerprintCalculator { public String calculateFingerprint(Throwable t) { MessageDigest md5 = getMD5Instance(); PrintStream ps = new PrintStream(new DigestOutputStream(new DoNothingOutputStream(), md5)); t.printStackTrace(ps); return base64Encoder.encodeToString(md5.digest()); } }
ThrowableFingerprintCalculator { public String calculateFingerprint(Throwable t) { MessageDigest md5 = getMD5Instance(); PrintStream ps = new PrintStream(new DigestOutputStream(new DoNothingOutputStream(), md5)); t.printStackTrace(ps); return base64Encoder.encodeToString(md5.digest()); }  }
ThrowableFingerprintCalculator { public String calculateFingerprint(Throwable t) { MessageDigest md5 = getMD5Instance(); PrintStream ps = new PrintStream(new DigestOutputStream(new DoNothingOutputStream(), md5)); t.printStackTrace(ps); return base64Encoder.encodeToString(md5.digest()); }  String calculateFingerprint(Throwable t); }
ThrowableFingerprintCalculator { public String calculateFingerprint(Throwable t) { MessageDigest md5 = getMD5Instance(); PrintStream ps = new PrintStream(new DigestOutputStream(new DoNothingOutputStream(), md5)); t.printStackTrace(ps); return base64Encoder.encodeToString(md5.digest()); }  String calculateFingerprint(Throwable t);  }