@Test public void testCompareTo() { VersionResponse versionResponse1 = new VersionResponse(); versionResponse1.setVersionNumber("0.1"); VersionResponse versionResponse3 = new VersionResponse(); versionResponse3.setVersionNumber("0.3"); VersionResponse versionResponse2 = new VersionResponse(); versionResponse2.setVersionNumber("0.2"); List<VersionResponse> versions = new ArrayList<VersionResponse>(); versions.add(versionResponse1); versions.add(versionResponse3); versions.add(versionResponse2); Collections.sort(versions); Assert.assertEquals(versions.get(0).getVersionNumber(), "0.3"); }
@Test public void testMarshall() throws JAXBException { String versionNumber = "7.5"; VersionResponse versionResponse = new VersionResponse(); versionResponse.setVersionNumber(versionNumber); LinkResponse linkResponse = new LinkResponse(); List<LinkResponse> links = new ArrayList<LinkResponse>(); links.add(linkResponse); LinksResponse linksResponse = new LinksResponse(); linksResponse.setLinks(links); versionResponse.setLinks(linksResponse); String marshalled = TestUtil.marshall(VersionResponse.class, versionResponse); VersionResponse unmarshalled = (VersionResponse) TestUtil.unmarshall(VersionResponse.class, marshalled); Assert.assertEquals(unmarshalled.getVersionNumber(), versionNumber); Assert.assertEquals(unmarshalled.getLinks().getLinks().size(), 1); }