@Test public void testSanityCheck1() { Key prev = new Key("r001", "f002", "q006"); assertEquals(prev, KeyShortener.sanityCheck(prev, new Key("r002", "f002", "q006"), new Key("r001", "f002", "q006"))); assertEquals(prev, KeyShortener.sanityCheck(prev, new Key("r003", "f002", "q006"), new Key("r001", "f002", "q006"))); assertEquals(prev, KeyShortener.sanityCheck(prev, new Key("r003", "f002", "q006"), new Key("r003", "f002", "q006"))); assertEquals(prev, KeyShortener.sanityCheck(prev, new Key("r003", "f002", "q006"), new Key("r004", "f002", "q006"))); }
@VisibleForTesting static Key sanityCheck(Key prev, Key current, Key shortened) { if (prev.compareTo(shortened) >= 0) { log.warn("Bug in key shortening code, please open an issue " + prev + " >= " + shortened); return prev; } if (current.compareTo(shortened) <= 0) { log.warn("Bug in key shortening code, please open an issue " + current + " <= " + shortened); return prev; } return shortened; }
KeyShortener { @VisibleForTesting static Key sanityCheck(Key prev, Key current, Key shortened) { if (prev.compareTo(shortened) >= 0) { log.warn("Bug in key shortening code, please open an issue " + prev + " >= " + shortened); return prev; } if (current.compareTo(shortened) <= 0) { log.warn("Bug in key shortening code, please open an issue " + current + " <= " + shortened); return prev; } return shortened; } }
KeyShortener { @VisibleForTesting static Key sanityCheck(Key prev, Key current, Key shortened) { if (prev.compareTo(shortened) >= 0) { log.warn("Bug in key shortening code, please open an issue " + prev + " >= " + shortened); return prev; } if (current.compareTo(shortened) <= 0) { log.warn("Bug in key shortening code, please open an issue " + current + " <= " + shortened); return prev; } return shortened; } private  KeyShortener(); }
KeyShortener { @VisibleForTesting static Key sanityCheck(Key prev, Key current, Key shortened) { if (prev.compareTo(shortened) >= 0) { log.warn("Bug in key shortening code, please open an issue " + prev + " >= " + shortened); return prev; } if (current.compareTo(shortened) <= 0) { log.warn("Bug in key shortening code, please open an issue " + current + " <= " + shortened); return prev; } return shortened; } private  KeyShortener(); static ByteSequence shorten(ByteSequence prev, ByteSequence current); static Key shorten(Key prev, Key current); }
KeyShortener { @VisibleForTesting static Key sanityCheck(Key prev, Key current, Key shortened) { if (prev.compareTo(shortened) >= 0) { log.warn("Bug in key shortening code, please open an issue " + prev + " >= " + shortened); return prev; } if (current.compareTo(shortened) <= 0) { log.warn("Bug in key shortening code, please open an issue " + current + " <= " + shortened); return prev; } return shortened; } private  KeyShortener(); static ByteSequence shorten(ByteSequence prev, ByteSequence current); static Key shorten(Key prev, Key current);  }