fastcampus-eatgo
fastcampus-eatgo copied to clipboard
지금 계속된오류로 진도를 못나가고있습니다. 빠른 확인 부탁드려요
강의자료에 Q&A 같은 보충자료를 못보고 강의만보고 하다가 버전이 달라 안되서 겨우겨우 AS 강의 올리신거 보고 다시 만들어서 만들어놨던 코드 복붙시키고 RUN을 했습니다.
이전에 JAVA11 버전으로 만들어서 다시 JAVA8 버전으로 바꿨었는데
크롬창을 켜서 localhost들어가서 포트키 치고 들어갔는데 아무리해도 새로바꾼 파일에 수정된 코드를 run돌린게 반영이 안되더라구요..
그래서 혹시나 싶어 이전 java11버전의 파일을 돌려보고 출력값이 !를 하나씩 다 달아서 다시 run해보니까 수정된 코드가 반영이 되더라구요...
어떻게 해야 java8버전의 새로운 파일이 웹 상에 반영되게 할 수 있을까요?? ㅠㅠ
그래도 어떻게든 하려고 하고있는데
package com.heesun.mycontact.interfaces;
import com.heesun.mycontact.domain.RestaurantRespositoryImpl;
import org.hamcrest.CoreMatchers;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
import org.springframework.boot.test.mock.mockito.SpyBean;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.ResultMatcher;
import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
import static org.hamcrest.Matchers.containsString;
import static org.springframework.test.web.client.match.MockRestRequestMatchers.content;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
@RunWith(SpringRunner.class)
@WebMvcTest(RestaurantControl.class)
public class RestaurantControlTest {
@Autowired
private MockMvc mvc;
@SpyBean(RestaurantRespositoryImpl.class)
private RestaurantRespositoryImpl restaurantRespositoryImpl;
@Test
public void list() throws Exception {
mvc.perform((get("/restaurants")))
.andExpect(status().isOk())
.andExpect((ResultMatcher) content().string(containsString("\"id\":1004")))
.andExpect(MockMvcResultMatchers.content().string(CoreMatchers.containsString("\"name\":\"Bob zip\""))
);
}
@Test
public void detail() throws Exception{
mvc.perform((get("/restaurant")))
.andExpect(status().isOk())
.andExpect((ResultMatcher) content().string(containsString("\"id\":1004")))
.andExpect(MockMvcResultMatchers.content().string(CoreMatchers.containsString("\"name\":\"Bob zip\"")))
.andExpect(MockMvcResultMatchers.content().string(
CoreMatchers.containsString("kimchi")
));
mvc.perform(get("/restaurant/2020"))
.andExpect(status().isOk())
.andExpect(MockMvcResultMatchers.content().string(CoreMatchers.containsString("\"id\":2020")))
.andExpect(MockMvcResultMatchers.content().string(CoreMatchers.containsString("\"name\":\"Cyber food\"")));
}
}
이 코드에서
Testing started at 오전 12:11 ...
> Task :compileJava
> Task :processResources UP-TO-DATE
> Task :classes
> Task :compileTestJava
> Task :processTestResources NO-SOURCE
> Task :testClasses
> Task :test
> Task :test FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':test'.
> No tests found for given includes: [com.heesun.mycontact.interfaces.RestaurantControlTest.detail](filter.includeTestsMatching)
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 18s
4 actionable tasks: 3 executed, 1 up-to-date
Publishing a build scan to scans.gradle.com requires accepting the Gradle Terms of Service defined at https://gradle.com/terms-of-service.
이렇게 계속 오류가 나고 있습니다,, 지금 일주일째 이러고있어요
굳이 버전은 바꾸실 필요가 없습니다. 이미 컴파일한 건 다시 컴파일하지 않기 때문에 중간에 변경하신 게 있다면 Rebuild를 하시면 됩니다.