우수한 PITest 프레임 워크를 사용하고 있습니다. PITest의 Sonars "// NOSONAR"에 해당하는 항목이 있는지 궁금 해서요. 특정 줄이 PITest 범위에서 제외되었으므로 (보고서에 빨간색이 표시되지 않습니다)? 메소드와 클래스가 제외 될 수 있다는 것을 알고 있습니다. 라인 레벨에서 좀 더 세밀한 것을 찾고 있습니다.PITest의 특정 코드 줄 제외
는 다음과 내가 가진 사용하는 경우와 같이 :
public enum FinancialStatementUserType {
CONSUMER, BUSINESS, RETAILER;
}
public static RecipientType toRecipientType(FinancialStatementUserType userType) {
Assert.notNull(userType, "userType is null");
switch (userType) {
case BUSINESS:
case CONSUMER:
return RecipientType.CustomerPerson;
case RETAILER:
return RecipientType.Seller;
default:
throw new IllegalStateException(String.format("No RecipientType for financial statement user type: %s", userType));
}
}
내가 가진 문제는 도달 할 수없는 '기본'절 모든 열거 현재 switch 문에 포함되어 있기 때문에 . 우리가 'detault'문을 추가 한 이유는 좋은 연습이라는 사실 외에도 미래에 enum이 확장되는 경우입니다.
아이디어가 있으십니까?