// Path: spring-boot-update-example/src/main/java/pl/codecouple/update/todo/Todo.java
// @Data
// @NoArgsConstructor
// @Entity
// public class Todo {
// 
//     @Id
//     @GeneratedValue
//     private Long id;
// 
//     private String title;
// 
//     private String description;
// 
//     public Todo(String title, String description) {
//         Assert.notNull(title, "Title cannot be null!");
//         Assert.hasLength(title, "Title cannot be empty!");
//         Assert.notNull(description, "Description cannot be null!");
//         Assert.hasLength(description, "Description cannot be empty!");
//         this.title = title;
//         this.description = description;
//     }
// 
// 
//     public Todo(Long id, String title, String description) {
//         Assert.notNull(title, "Title cannot be null!");
//         Assert.hasLength(title, "Title cannot be empty!");
//         Assert.notNull(description, "Description cannot be null!");
//         Assert.hasLength(description, "Description cannot be empty!");
//         Assert.notNull(id, "ID cannot be null!");
//         this.id = id;
//         this.title = title;
//         this.description = description;
//     }
// }
// 
// Path: spring-boot-update-example/src/main/java/pl/codecouple/update/todo/TodoService.java
// @Service
// public class TodoService {
// 
// 
//     private final TodoRepository todoRepository;
// 
//     public TodoService(TodoRepository todoRepository) {
//         this.todoRepository = todoRepository;
//     }
// 
// 
//     public void addNewTodo(Todo todo) {
//         todoRepository.save(todo);
//     }
// 
//     public void update(Todo todo) {
//         todoRepository.save(todo);
//     }
// 
//     public Todo getTodoById(Long id){
//         return todoRepository.findOne(id);
//     }
// 
//     public void partialUpdated(Todo todo) {
//         todoRepository.save(todo);
//     }
// }


import com.fasterxml.jackson.databind.ObjectMapper;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.jdbc.AutoConfigureTestDatabase;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.http.MediaType;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.ResultActions;
import pl.codecouple.update.todo.Todo;
import pl.codecouple.update.todo.TodoService;
import java.util.HashMap;
import static org.assertj.core.api.Assertions.assertThat;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.patch;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
package pl.codecouple.update;




@RunWith(SpringRunner.class)
@SpringBootTest
@AutoConfigureMockMvc
@AutoConfigureTestDatabase
public class UpdateExampleApplicationTests {

	private final ObjectMapper objectMapper = new ObjectMapper();

	@Autowired
	private MockMvc mvc;

	@Autowired
	private TodoService todoService;


	@Test
	public void shouldPartialUpdateTodo() throws Exception {
		// Given
// Path: spring-boot-update-example/src/main/java/pl/codecouple/update/todo/Todo.java
// @Data
// @NoArgsConstructor
// @Entity
// public class Todo {
// 
//     @Id
//     @GeneratedValue
//     private Long id;
// 
//     private String title;
// 
//     private String description;
// 
//     public Todo(String title, String description) {
//         Assert.notNull(title, "Title cannot be null!");
//         Assert.hasLength(title, "Title cannot be empty!");
//         Assert.notNull(description, "Description cannot be null!");
//         Assert.hasLength(description, "Description cannot be empty!");
//         this.title = title;
//         this.description = description;
//     }
// 
// 
//     public Todo(Long id, String title, String description) {
//         Assert.notNull(title, "Title cannot be null!");
//         Assert.hasLength(title, "Title cannot be empty!");
//         Assert.notNull(description, "Description cannot be null!");
//         Assert.hasLength(description, "Description cannot be empty!");
//         Assert.notNull(id, "ID cannot be null!");
//         this.id = id;
//         this.title = title;
//         this.description = description;
//     }
// }
// 
// Path: spring-boot-update-example/src/main/java/pl/codecouple/update/todo/TodoService.java
// @Service
// public class TodoService {
// 
// 
//     private final TodoRepository todoRepository;
// 
//     public TodoService(TodoRepository todoRepository) {
//         this.todoRepository = todoRepository;
//     }
// 
// 
//     public void addNewTodo(Todo todo) {
//         todoRepository.save(todo);
//     }
// 
//     public void update(Todo todo) {
//         todoRepository.save(todo);
//     }
// 
//     public Todo getTodoById(Long id){
//         return todoRepository.findOne(id);
//     }
// 
//     public void partialUpdated(Todo todo) {
//         todoRepository.save(todo);
//     }
// }


// Path: spring-boot-update-example/src/test/java/pl/codecouple/update/UpdateExampleApplicationTests.java
import com.fasterxml.jackson.databind.ObjectMapper;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.jdbc.AutoConfigureTestDatabase;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.http.MediaType;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.ResultActions;
import pl.codecouple.update.todo.Todo;
import pl.codecouple.update.todo.TodoService;
import java.util.HashMap;
import static org.assertj.core.api.Assertions.assertThat;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.patch;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;

package pl.codecouple.update;




@RunWith(SpringRunner.class)
@SpringBootTest
@AutoConfigureMockMvc
@AutoConfigureTestDatabase
public class UpdateExampleApplicationTests {

	private final ObjectMapper objectMapper = new ObjectMapper();

	@Autowired
	private MockMvc mvc;

	@Autowired
	private TodoService todoService;


	@Test
	public void shouldPartialUpdateTodo() throws Exception {
		// Given
		todoService.addNewTodo(new Todo("title", "description"));