/*
 * MIT License
 *
 * Copyright (c) 2018 JUAN CALVOPINA M
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */

package com.jcalvopinam.api.web;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.MvcResult;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.mockito.Mockito.when;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;

@RunWith(SpringRunner.class)
@WebMvcTest(value = HomeController.class, secure = false)
public class HomeControllerTest {

    static final String ACCESS_CONTROL_REQUEST_METHOD = "Access-Control-Request-Method";
    static final String ORIGIN = "Origin";
    static final String HOST = "http://localhost:8080";
    static final String GET = "GET";

    @Autowired
    private MockMvc mockMvc;

    @Mock
    private HomeController homeController;

    @Test
    public void home() throws Exception {
        String expected = "Prototype Model Api\nWelcome to the API's list the server Time is:";

        when(homeController.home()).thenReturn(expected);

        MvcResult mvcResult = mockMvc.perform(get("/")
                                                      .header(ACCESS_CONTROL_REQUEST_METHOD, GET)
                                                      .header(ORIGIN, HOST))
                                     .andReturn();
        String result = mvcResult.getResponse().getContentAsString();
        assertNotNull(result);
        assertEquals(expected, result.substring(0, 65));
    }

}
@@ -1504,193 +1504,279 @@
 vc;%0A
+%0A
 import 
-org.springframework.test.web.servlet.MvcResult;%0A%0Aimport static org.junit.Assert.assertEquals;%0Aimport static org.junit.Assert.assertNotNull;%0Aimport static org.mockito.Mockito.wh
+static org.hamcrest.CoreMatchers.containsString;%0Aimport static org.mockito.Mockito.when;%0Aimport static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;%0Aimport static org.springframework.test.web.servlet.result.MockMvcResultMatchers.cont
 en
+t
 ;%0Aim
@@ -1818,36 +1818,35 @@
 t.web.servlet.re
-ques
+sul
 t.MockMvcRequest
@@ -1840,33 +1840,35 @@
 ockMvcRe
-questBuilders.get
+sultMatchers.status
 ;%0A%0A@RunW
@@ -2528,30 +2528,8 @@
     
- MvcResult mvcResult =
  moc
@@ -2582,38 +2582,16 @@
         
-         
-             
 .header(
@@ -2658,38 +2658,16 @@
         
-                  
-    
 .header(
@@ -2700,198 +2700,103 @@
     
-                      .andReturn();%0A        String result = mvcResult.getResponse().getC
+.andExpect(status().isOk())%0A               .andExpect(c
 ontent
-AsS
+().s
 tring(
-);%0A        assertNotNull(result);%0A        assertEquals(expected, result.substring(0, 65
+containsString(expected)
 ));%0A

Improve the test with the expected value