assertThat(xpath.evaluate("/feed/link/@href", doc), is(siteUrl.getAbsoluteUrl("/blog/category/news")));
}
@Test
public void containsBlogPostFields() throws Exception {
Post post = PostBuilder.post().category(PostCategory.ENGINEERING).isBroadcast().build();
postRepository.save(post);
ResultActions resultActions = mockMvc.perform(get("/blog.atom"));
MvcResult mvcResult = resultActions
.andExpect(status().isOk())
.andExpect(content().contentTypeCompatibleWith("application/atom+xml"))
.andReturn();
assertThat(mvcResult.getResponse().getCharacterEncoding(), equalTo("utf-8"));
String atomFeed = mvcResult.getResponse().getContentAsString();
assertThat(atomFeed, containsString(post.getTitle()));
assertThat(atomFeed, containsString(post.getRenderedContent()));
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
dateFormat.setTimeZone(DateFactory.DEFAULT_TIME_ZONE);
String postDate = dateFormat.format(post.getCreatedAt());
assertThat(atomFeed, containsString(postDate));
assertThat(atomFeed, containsString("/blog/" + post.getPublicSlug()));
assertThat(atomFeed, containsString(PostCategory.ENGINEERING.getDisplayName()));
assertThat(atomFeed, containsString("Broadcast"));
}