- public void verifyThatAMissingClientCausesTheOriginalClientToBeUsed() {
- Optional<Sone> sone = soneParser.parseSone(database, originalSone, getXml("missing-client"));
- assertThat(sone, notNullValue());
- assertThat(sone.isPresent(), is(true));
- assertThat(sone.get().getClient(), notNullValue());
- assertThat(sone.get().getClient(), is(originalSone.getClient()));
+ public void verifyThatAMissingPostLikesSectionDoesNotCauseAnError() {
+ soneParser.parseSone(database, originalSone, getXml("missing-post-likes"));
+ }
+
+ @Test
+ public void verifyThatAMissingReplyLikesSectionDoesNotCauseAnError() {
+ soneParser.parseSone(database, originalSone, getXml("missing-reply-likes"));
+ }
+
+ @Test
+ public void verifyThatMissingAlbumsSectionDoNotCauseAnError() {
+ soneParser.parseSone(database, originalSone, getXml("missing-albums"));
+ }
+
+ @Test(expected = MalformedXml.class)
+ public void verifyThatAnInvalidAlbumCausesAnError() {
+ soneParser.parseSone(database, originalSone, getXml("invalid-album"));
+ }
+
+ @Test
+ public void verifyThatAnEmptyProfileIsParsedWithoutError() {
+ Sone sone = soneParser.parseSone(database, originalSone, getXml("empty-profile"));
+ assertThat(sone.getProfile().getFirstName(), nullValue());
+ assertThat(sone.getProfile().getMiddleName(), nullValue());
+ assertThat(sone.getProfile().getLastName(), nullValue());
+ assertThat(sone.getProfile().getBirthYear(), nullValue());
+ assertThat(sone.getProfile().getBirthMonth(), nullValue());
+ assertThat(sone.getProfile().getBirthDay(), nullValue());
+ assertThat(sone.getProfile().getAvatar(), nullValue());
+ assertThat(sone.getProfile().getFields(), empty());