@@ -0,0 +1,2051 @@
+package co.lilpilot.blog.service;%0A%0Aimport co.lilpilot.blog.model.Post;%0Aimport co.lilpilot.blog.model.Tag;%0Aimport org.junit.Assert;%0Aimport org.junit.Test;%0Aimport org.junit.Before;%0Aimport org.junit.After;%0Aimport org.junit.runner.RunWith;%0Aimport org.springframework.beans.factory.annotation.Autowired;%0Aimport org.springframework.boot.test.context.SpringBootTest;%0Aimport org.springframework.test.context.junit4.SpringRunner;%0A%0Aimport java.util.ArrayList;%0Aimport java.util.List;%0A%0A/**%0A * PostService Tester.%0A *%0A * @author %3CAuthors name%3E%0A * @version 1.0%0A * @since %3Cpre%3E%EF%BF%BD%EF%BF%BD%EF%BF%BD%EF%BF%BD 2, 2017%3C/pre%3E%0A */%0A@RunWith(SpringRunner.class)%0A@SpringBootTest%0Apublic class PostServiceTest %7B%0A%0A    @Autowired%0A    private PostService postService;%0A%0A    @Before%0A    public void before() throws Exception %7B%0A    %7D%0A%0A    @After%0A    public void after() throws Exception %7B%0A    %7D%0A%0A    /**%0A     * Method: getByTitle(String title)%0A     */%0A    @Test%0A    public void testGetByTitle() throws Exception %7B%0A        Assert.assertNull(postService.getByTitle(%22test%22));%0A        Post post = new Post();%0A        post.setTitle(%22test%22);%0A        post.setContent(%22hello world%22);%0A        Tag tag = new Tag();%0A        tag.setName(%22tag_test%22);%0A        post.addTag(tag);%0A        postService.saveOrUpdate(post);%0A        Assert.assertNotNull(postService.getByTitle(%22test%22));%0A    %7D%0A%0A    /**%0A     * Method: saveOrUpdate(Post post)%0A     */%0A    @Test%0A    public void testSaveOrUpdate() throws Exception %7B%0A%0A        //test save%0A        Assert.assertNull(postService.getByTitle(%22test%22));%0A        Post post = new Post();%0A        post.setTitle(%22test%22);%0A        post.setContent(%22hello world%22);%0A        Tag tag = new Tag();%0A        tag.setName(%22tag_test%22);%0A        post.addTag(tag);%0A        postService.saveOrUpdate(post);%0A        Assert.assertNotNull(postService.getByTitle(%22test%22));%0A%0A        //test update%0A        Assert.assertNull(postService.getByTitle(%22update_test%22));%0A        post.setTitle(%22update_test%22);%0A        postService.saveOrUpdate(post);%0A        Assert.assertNotNull(postService.getByTitle(%22update_test%22));%0A    %7D%0A%7D%0A

add test file to git