// Path: app/src/main/java/de/codecentric/Application.java
// @EnableAutoConfiguration
// @SpringBootApplication
// @ComponentScan
// @Import(ApplicationWebConfiguration.class)
// public class Application extends SpringBootServletInitializer {
// 
//     public static void main(String[] args) {
//         SpringApplication.run(Application.class, args);
//     }
// 
//     @Override
//     protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
//         return application.sources(Application.class);
//     }
// }
// 
// Path: app/src/main/java/de/codecentric/dao/FeedbackDao.java
// public interface FeedbackDao {
// 
//     public void save(Feedback feedback);
// 
//     public List<Feedback> getFeedbackList();
// }
// 
// Path: app/src/main/java/de/codecentric/domain/Feedback.java
// @Entity(name = "feedback")
// @NamedQueries({ @NamedQuery(name = "findFeedback", query = "from feedback order by timestamp desc") })
// public class Feedback {
// 
//     @Id
//     @GeneratedValue(strategy = GenerationType.AUTO)
//     private long id;
// 
//     private String userName;
//     @Lob
//     private String feedbackComment;
// 
//     @Temporal(TemporalType.TIMESTAMP)
//     private Date timestamp;
// 
//     public long getId() {
//         return id;
//     }
// 
//     public void setId(long id) {
//         this.id = id;
//     }
// 
//     public String getUserName() {
//         return userName;
//     }
// 
//     public void setUserName(String userName) {
//         this.userName = userName;
//     }
// 
//     public String getFeedbackComment() {
//         return feedbackComment;
//     }
// 
//     public void setFeedbackComment(String feedbackComment) {
//         this.feedbackComment = feedbackComment;
//     }
// 
//     public Date getTimestamp() {
//         return timestamp;
//     }
// 
//     public void setTimestamp(Date timestamp) {
//         this.timestamp = timestamp;
//     }
// 
// }
// 
// Path: app/src/main/java/de/codecentric/model/FeedbackFormData.java
// public class FeedbackFormData {
// 
//     private String id;
//     private String name;
//     private String feedbackContent;
// 
//     public String getFeedbackContent() {
//         return feedbackContent;
//     }
// 
//     public void setFeedbackContent(String feedbackContent) {
//         this.feedbackContent = feedbackContent;
//     }
// 
//     public String getName() {
//         return name;
//     }
// 
//     public void setName(String name) {
//         this.name = name;
//     }
// 
//     public String getId() {
//         return id;
//     }
// 
//     public void setId(String id) {
//         this.id = id;
//     }
// 
// }


import static org.hamcrest.Matchers.containsString;
import static org.mockito.Mockito.when;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.model;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.view;
import static org.springframework.test.web.servlet.setup.MockMvcBuilders.standaloneSetup;
import java.util.Arrays;
import java.util.List;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.WebAppConfiguration;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.web.servlet.View;
import de.codecentric.Application;
import de.codecentric.dao.FeedbackDao;
import de.codecentric.domain.Feedback;
import de.codecentric.model.FeedbackFormData;
package de.codecentric.controller;





@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = { Application.class, FeedbackDao.class })
@WebAppConfiguration
public class FeedbackControllerTest {

    @InjectMocks
    FeedbackController controller;

    @Mock
    FeedbackDao feedbackDao;

    @Mock
    View mockView;

    private MockMvc mockMvc;

    @Before
    public void setup() {
        MockitoAnnotations.initMocks(this);
        mockMvc = standaloneSetup(controller).setSingleView(mockView).build();
    }

    @Test
    public void testGetFeedbackList() throws Exception {
        List<Feedback> feedbackList = Arrays.asList(new Feedback());
        when(feedbackDao.getFeedbackList()).thenReturn(feedbackList);

        mockMvc.perform(get("/feedback")).andExpect(status().isOk()).andExpect(model().attribute("feedbackList", feedbackList)).andExpect(view().name("feedback"));
    }

    @Test
    public void testPostNewFeedback() throws Exception {
// Path: app/src/main/java/de/codecentric/Application.java
// @EnableAutoConfiguration
// @SpringBootApplication
// @ComponentScan
// @Import(ApplicationWebConfiguration.class)
// public class Application extends SpringBootServletInitializer {
// 
//     public static void main(String[] args) {
//         SpringApplication.run(Application.class, args);
//     }
// 
//     @Override
//     protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
//         return application.sources(Application.class);
//     }
// }
// 
// Path: app/src/main/java/de/codecentric/dao/FeedbackDao.java
// public interface FeedbackDao {
// 
//     public void save(Feedback feedback);
// 
//     public List<Feedback> getFeedbackList();
// }
// 
// Path: app/src/main/java/de/codecentric/domain/Feedback.java
// @Entity(name = "feedback")
// @NamedQueries({ @NamedQuery(name = "findFeedback", query = "from feedback order by timestamp desc") })
// public class Feedback {
// 
//     @Id
//     @GeneratedValue(strategy = GenerationType.AUTO)
//     private long id;
// 
//     private String userName;
//     @Lob
//     private String feedbackComment;
// 
//     @Temporal(TemporalType.TIMESTAMP)
//     private Date timestamp;
// 
//     public long getId() {
//         return id;
//     }
// 
//     public void setId(long id) {
//         this.id = id;
//     }
// 
//     public String getUserName() {
//         return userName;
//     }
// 
//     public void setUserName(String userName) {
//         this.userName = userName;
//     }
// 
//     public String getFeedbackComment() {
//         return feedbackComment;
//     }
// 
//     public void setFeedbackComment(String feedbackComment) {
//         this.feedbackComment = feedbackComment;
//     }
// 
//     public Date getTimestamp() {
//         return timestamp;
//     }
// 
//     public void setTimestamp(Date timestamp) {
//         this.timestamp = timestamp;
//     }
// 
// }
// 
// Path: app/src/main/java/de/codecentric/model/FeedbackFormData.java
// public class FeedbackFormData {
// 
//     private String id;
//     private String name;
//     private String feedbackContent;
// 
//     public String getFeedbackContent() {
//         return feedbackContent;
//     }
// 
//     public void setFeedbackContent(String feedbackContent) {
//         this.feedbackContent = feedbackContent;
//     }
// 
//     public String getName() {
//         return name;
//     }
// 
//     public void setName(String name) {
//         this.name = name;
//     }
// 
//     public String getId() {
//         return id;
//     }
// 
//     public void setId(String id) {
//         this.id = id;
//     }
// 
// }


// Path: app/src/test/java/de/codecentric/controller/FeedbackControllerTest.java
import static org.hamcrest.Matchers.containsString;
import static org.mockito.Mockito.when;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.model;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.view;
import static org.springframework.test.web.servlet.setup.MockMvcBuilders.standaloneSetup;
import java.util.Arrays;
import java.util.List;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.WebAppConfiguration;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.web.servlet.View;
import de.codecentric.Application;
import de.codecentric.dao.FeedbackDao;
import de.codecentric.domain.Feedback;
import de.codecentric.model.FeedbackFormData;

package de.codecentric.controller;





@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = { Application.class, FeedbackDao.class })
@WebAppConfiguration
public class FeedbackControllerTest {

    @InjectMocks
    FeedbackController controller;

    @Mock
    FeedbackDao feedbackDao;

    @Mock
    View mockView;

    private MockMvc mockMvc;

    @Before
    public void setup() {
        MockitoAnnotations.initMocks(this);
        mockMvc = standaloneSetup(controller).setSingleView(mockView).build();
    }

    @Test
    public void testGetFeedbackList() throws Exception {
        List<Feedback> feedbackList = Arrays.asList(new Feedback());
        when(feedbackDao.getFeedbackList()).thenReturn(feedbackList);

        mockMvc.perform(get("/feedback")).andExpect(status().isOk()).andExpect(model().attribute("feedbackList", feedbackList)).andExpect(view().name("feedback"));
    }

    @Test
    public void testPostNewFeedback() throws Exception {
        FeedbackFormData formData = new FeedbackFormData();