@Test public void testCreateOnePost() throws Exception { postIndexRepository.save(post1); Post actualPost = postIndexRepository.findOne(post1.getId()); PostSearchAssert.assertEquals(post1, actualPost); }
@Test public void testCreateMultiplePosts() throws Exception { List<Post> expected = Arrays.asList(post1, post2); List<Post> actual = new ArrayList<Post>(); postIndexRepository.save(expected); for (Post post : postIndexRepository.findAll()) { actual.add(post); } PostSearchAssert.assertEquals(actual, expected); }
@Test public void testGetNullSuggestion() throws Exception { String result = suggestService.getMostLikelySuggestions("apple phone"); PostSearchAssert.assertEquals(result, null); }
@Test public void testGetMostLikelySuggestions() throws Exception { String result = suggestService.getMostLikelySuggestions("aple juize"); PostSearchAssert.assertEquals(result, "apple juice"); }