MavenMetadata { public static MavenMetadata unmarshalMavenMetadata(InputStream in) throws Exception { Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); return unmarshaller.unmarshal(new StreamSource(in), MavenMetadata.class).getValue(); }  static MavenMetadata unmarshalMavenMetadata(InputStream in); static MavenMetadata unmarshalMavenMetadata(String in); static void marshalMavenMetadata(File file, MavenMetadata metadata); @XmlElement
    public String groupId; @XmlElement
    public String artifactId; @XmlElement
    public String version; @XmlElement
    public Versioning versioning; }
@Test public void testSnapshotVersion() throws Exception { String xml = Resources.toString(Resources.getResource(getClass(), "banana-maven-metadata.xml"), UTF_8); MavenMetadata metadata = unmarshalMavenMetadata(xml); assertNotNull(metadata); assertEquals(metadata.groupId, "food.fruit"); assertEquals(metadata.artifactId, "banana"); assertEquals(metadata.version, "2.0-SNAPSHOT"); assertNotNull(metadata.versioning); assertNotNull(metadata.versioning.snapshot); assertEquals(metadata.versioning.snapshot.timestamp, "20110311.201909"); assertEquals(metadata.versioning.snapshot.buildNumber, "1"); assertNotNull(metadata.versioning.snapshotVersions); assertEquals(metadata.versioning.lastUpdated, "20110311201909"); }
@Test public void testArtifactDir() throws Exception { String xml = Resources.toString(Resources.getResource(getClass(), "apple-maven-metadata.xml"), UTF_8); MavenMetadata metadata = unmarshalMavenMetadata(xml); assertNotNull(metadata); assertEquals(metadata.groupId, "food.fruit"); assertEquals(metadata.artifactId, "apple"); assertEquals(metadata.versioning.latest, "2.0"); assertEquals(metadata.versioning.release, "2.0"); assertNotNull(metadata.versioning); assertNull(metadata.versioning.snapshot); assertEquals(metadata.versioning.snapshotVersions, ImmutableList.of()); assertEquals(metadata.versioning.lastUpdated, "20110304215947"); }