JkMavenMetadata { public void updateSnapshot(String timestamp) { if (versioning == null) { this.versioning = new Versioning(); } final int buildNumber = this.versioning.currentBuildNumber() + 1; this.versioning.snapshot = new JkSnapshot(timestamp, buildNumber); this.versioning.lastUpdate = timestamp.replace(".", ""); this.versioning.snapshotVersions.clear(); } private  JkMavenMetadata(); static JkMavenMetadata of(JkVersionedModule versionedModule, String timestamp); static JkMavenMetadata of(JkModuleId moduleId); static JkMavenMetadata of(InputStream inputStream); void updateSnapshot(String timestamp); JkSnapshot currentSnapshot(); void addSnapshotVersion(String extension, String classifier); int currentBuildNumber(); void addVersion(String version, String timestamp); void output(OutputStream outputStream); String lastUpdateTimestamp();  }
@Test public void testupdateSnapshot() throws UnsupportedEncodingException { final JkMavenMetadata mavenMetadata = JkMavenMetadata.of(JkModuleId.of("dev.jeka", "core") .withVersion("0.1-SNAPSHOT"), "11111111.222222"); mavenMetadata.updateSnapshot("20151023145532"); mavenMetadata.addSnapshotVersion("jar", "source"); ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); mavenMetadata.output(outputStream); final String string = outputStream.toString("UTF-8"); final ByteArrayInputStream inputStream = new ByteArrayInputStream(string.getBytes()); final JkMavenMetadata readData = JkMavenMetadata.of(inputStream); outputStream = new ByteArrayOutputStream(); readData.output(outputStream); final String string2 = outputStream.toString("UTF-8"); System.out.println(string2); Assert.assertEquals(string, string2); }