Source:
public void serDeTest() throws IOException { UUID sessionId = new UUID(0, 0); UUID incarnationId = new UUID(0, 0); String logSegmentName = LogSegmentNameHelper.generateFirstSegmentName(numSegments); Offset offset = new Offset(logSegmentName, 0); MockId key = new MockId(UtilsTest.getRandomString(10)); if (numSegments == 1) { doSerDeTest(new StoreFindToken(), StoreFindToken.VERSION_0, StoreFindToken.VERSION_1, StoreFindToken.VERSION_2); doSerDeTest(new StoreFindToken(offset, sessionId, null, false), StoreFindToken.VERSION_0, StoreFindToken.VERSION_0); doSerDeTest(new StoreFindToken(offset, sessionId, incarnationId, false), StoreFindToken.VERSION_0, StoreFindToken.VERSION_1, StoreFindToken.VERSION_2); doSerDeTest(new StoreFindToken(offset, sessionId, incarnationId, true), StoreFindToken.VERSION_2); doSerDeTest(new StoreFindToken(key, offset, sessionId, null), StoreFindToken.VERSION_0, StoreFindToken.VERSION_1); doSerDeTest(new StoreFindToken(key, offset, sessionId, incarnationId), StoreFindToken.VERSION_0, StoreFindToken.VERSION_1, StoreFindToken.VERSION_2); } else { doSerDeTest(new StoreFindToken(), StoreFindToken.VERSION_1, StoreFindToken.VERSION_2); doSerDeTest(new StoreFindToken(offset, sessionId, null, false), StoreFindToken.VERSION_1); doSerDeTest(new StoreFindToken(offset, sessionId, incarnationId, false), StoreFindToken.VERSION_1, StoreFindToken.VERSION_2); doSerDeTest(new StoreFindToken(offset, sessionId, incarnationId, true), StoreFindToken.VERSION_2); doSerDeTest(new StoreFindToken(key, offset, sessionId, null), StoreFindToken.VERSION_1); doSerDeTest(new StoreFindToken(key, offset, sessionId, incarnationId), StoreFindToken.VERSION_1, StoreFindToken.VERSION_2); } }

Target:
public void serDeTest() throws IOException { UUID sessionId = UUID.randomUUID(); UUID incarnationId = UUID.randomUUID(); String logSegmentName = LogSegmentNameHelper.generateFirstSegmentName(numSegments); Offset offset = new Offset(logSegmentName, 0); MockId key = new MockId(UtilsTest.getRandomString(10)); if (numSegments == 1) { doSerDeTest(new StoreFindToken(), StoreFindToken.VERSION_0, StoreFindToken.VERSION_1, StoreFindToken.VERSION_2); doSerDeTest(new StoreFindToken(offset, sessionId, null, false), StoreFindToken.VERSION_0, StoreFindToken.VERSION_1); doSerDeTest(new StoreFindToken(offset, sessionId, incarnationId, false), StoreFindToken.VERSION_0, StoreFindToken.VERSION_1, StoreFindToken.VERSION_2); doSerDeTest(new StoreFindToken(offset, sessionId, incarnationId, true), StoreFindToken.VERSION_2); doSerDeTest(new StoreFindToken(key, offset, sessionId, null), StoreFindToken.VERSION_0, StoreFindToken.VERSION_1); doSerDeTest(new StoreFindToken(key, offset, sessionId, incarnationId), StoreFindToken.VERSION_0, StoreFindToken.VERSION_1, StoreFindToken.VERSION_2); } else { doSerDeTest(new StoreFindToken(), StoreFindToken.VERSION_1, StoreFindToken.VERSION_2); doSerDeTest(new StoreFindToken(offset, sessionId, null, false), StoreFindToken.VERSION_1); doSerDeTest(new StoreFindToken(offset, sessionId, incarnationId, false), StoreFindToken.VERSION_1, StoreFindToken.VERSION_2); doSerDeTest(new StoreFindToken(offset, sessionId, incarnationId, true), StoreFindToken.VERSION_2); doSerDeTest(new StoreFindToken(key, offset, sessionId, null), StoreFindToken.VERSION_1); doSerDeTest(new StoreFindToken(key, offset, sessionId, incarnationId), StoreFindToken.VERSION_1, StoreFindToken.VERSION_2); } }