-
카테고리
-
세부 분야
백엔드
-
해결 여부
미해결
vetController 부분에서 오류가 납니다. - 처음 Maven 실행 부분 입니다.
20.12.10 00:22 작성 조회수 559
0
[INFO]
[INFO] Results:
[INFO]
[ERROR] Failures:
[ERROR] VetControllerTests.testShowResourcesVetList:75 Status expected:<200> but was:<406>
[ERROR] Errors:
[ERROR] PetclinicIntegrationTests.testFindAll » IllegalState Failed to load Applicatio...
[INFO]
[ERROR] Tests run: 40, Failures: 1, Errors: 1, Skipped: 1
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 21.446 s
[INFO] Finished at: 2020-12-10T00:09:20+09:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.22.2:test (default-test) on project spring-petclinic: There are test failures.
[ERROR]
[ERROR] Please refer to /Users/username/IdeaProjects/spring-petclinic/target/surefire-reports for the individual test results.
[ERROR] Please refer to dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream.
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
안녕하세요 선생님,
git 으로부터 소스코드 다운받고, 1.8 버전의 jdk 로 했습니다.
그런다음에 maven
--> mvnw package
의 명령어를 터미널 켜서 쳤는데, 이러한 오류가 발생했습니다.
제가 스프링 코드를 아예 볼 줄 몰라서 구글링을 해 봤는데..
찾은 코드를 어디에 넣어야 할지 몰라서 이렇게 질문 남기게 되었습니다.
위는 오류 메세지 입니다.
혹시 몰라서 VetController 코드도 올려 보겠습니다.
package org.springframework.samples.petclinic.vet;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.Map;
/**
* @author Juergen Hoeller
* @author Mark Fisher
* @author Ken Krebs
* @author Arjen Poutsma
*/
@Controller
class VetController {
private final VetRepository vets;
public VetController(VetRepository clinicService) {
this.vets = clinicService;
}
@GetMapping("/vets.html")
public String showVetList(Map<String, Object> model) {
// Here we are returning an object of type 'Vets' rather than a collection of Vet
// objects so it is simpler for Object-Xml mapping
Vets vets = new Vets();
vets.getVetList().addAll(this.vets.findAll());
model.put("vets", vets);
return "vets/vetList";
}
@GetMapping({ "/vets" })
public @ResponseBody Vets showResourcesVetList() {
// Here we are returning an object of type 'Vets' rather than a collection of Vet
// objects so it is simpler for JSon/Object mapping
Vets vets = new Vets();
vets.getVetList().addAll(this.vets.findAll());
return vets;
}
}
답변을 작성해보세요.
0
백기선
지식공유자2020.12.11
로그를 읽어보시면 showResourcesVetList 테스트 케이스가 실패해서 빌드가 실패했다는 것을 알 수 있을 겁니다. 그러면 이제 해당 테스트를 실행해서 왜 실패하는지 알아내야겠죠?
지금 제공해 주신 정보로는 여기까지고.. 그 뒤에는 말씀드린대로 테스트 실행하면서 디버깅하고 왜 200 응답 대신 406이 나오는지 찾아보세요.
답변 1