### Question:
UUIDSequence implements KeySequence { @Override public CharSequence nextWriterKey() { return new UUID(seqId, writerIndex.incrementAndGet()).toString(); } UUIDSequence(KeySequenceConfig keySequenceConfig); @Override CharSequence nextReaderKey(); @Override CharSequence nextWriterKey(); @Override long readerKeysAvailable(); @Override KeySequenceConfig getConfig(boolean sharedInstance); @Override Iterator<CharSequence> nextReaderKeys(long maxKeys); @Override boolean equals(Object obj); @Override int hashCode(); static final int RESERVED_KEYS; }### Answer:
@Test public void returnsNextWriterKeyExcludingCurrent() { CharSequence expectedFirstKey = getNextExpectedKey(RESERVED_KEYS + 1); CharSequence expectedSecondKey = getNextExpectedKey(RESERVED_KEYS + 2); KeySequenceConfig config = createDefaultTestKeySequenceConfig(); KeySequence sequence = createDefaultTestUUIDSequence(config); CharSequence key1 = sequence.nextWriterKey(); CharSequence key2 = sequence.nextWriterKey(); assertEquals(expectedFirstKey, key1); assertEquals(expectedSecondKey, key2); }