메소드 : doctorQueue
: 데이터 유형 (java.util.Date), 시간 및 ID (string)의 세 가지 매개 변수를 갖는 메소드가 있습니다.Junit 메소드의 Java-Junit/오해
반환 값은 void
이며 이미 같은 시간에 대기열이 있으면 예외가 발생합니다. The method assertTrue(boolean) in the type Assert is not applicable for the arguments (void)
:
public void checkQueueDoctor(){
Date date = new Date (2012,4,25);
Time time = new Time (13, 0, 0);
assertTrue(doctorQueue("83849829", date, time));
..... // and so on
}
그것은 나에게 다음 문제를 제공합니다 :
나는 Junit와를 사용하여, 다음 방법을 썼다.나는 그것을 이해하고 있지만 함수를 검사 할 수있는 방법은 반환 값이 무효라는 것인가?
볼 수 있습니다 방법, 그냥 메서드를 호출합니다. try ... catch 메서드를 호출하면 원래 예외가 숨겨집니다. – NamshubWriter