ChunksManifest extends ChunksManifestBean { public String nextChunkId() { if (chunkIndex >= MAX_CHUNKS) { throw new DuraCloudRuntimeException("Max chunks: " + MAX_CHUNKS); } return getHeader().getSourceContentId() + chunkSuffix + nextChunkIndex(); } ChunksManifest(ChunksManifestBean bean);  ChunksManifest(String sourceContentId,
                          String sourceMimetype,
                          long sourceByteSize); void setMD5OfSourceContent(String md5); String getManifestId(); String nextChunkId(); void addEntry(String chunkId, String chunkMD5, long chunkSize); KnownLengthInputStream getBody(); String getMimetype(); static final String SCHEMA_VERSION; final static String chunkSuffix; final static String manifestSuffix; }
@Test public void testNextChunkId() { String chunkId; String prefix = sourceContentId + ".dura-chunk-"; for (int i = 0; i < 10000; ++i) { chunkId = manifest.nextChunkId(); Assert.assertNotNull(chunkId); Assert.assertEquals(prefix + getChunkIndex(i), chunkId); } boolean thrown = false; try { manifest.nextChunkId(); Assert.fail("Exception expected"); } catch (Exception e) { thrown = true; } Assert.assertTrue(thrown); }