Hi to all, I use maven plugin Cobertura 2.7. I want to test the below method.
protected void validateCategoryAndAssociatedQuestionType(CategoryQuestionDto dto, Category cat, Question que) {
if (!((cat instanceof TriviaCategory && que instanceof TriviaQuestion) || (cat instanceof TestCategory && que instanceof TestQuestion) || (cat instanceof GuessingGameCategory && que instanceof GuessingGameQuestion)))
{
throw new QuestionAndCategoryNotOfTheSameTypeException("Question with id: " + dto.getId().getQuestionId() + " and Category with id: " + dto.getId().getCategoryId() + " are not of the same type");
}
}
and I am testing this with the below test.
@Test(expected = QuestionAndCategoryNotOfTheSameTypeException.class)
public void validateCategoryAndAssociatedQuestionTypeFailure6(){
GuessingGameCategory category = new GuessingGameCategory();
TestQuestion question = new TestQuestion();
question.setId(1);
category.setId(1);
CategoryQuestion pair = new CategoryQuestion(category, question, (short)1);
service.validateCategoryAndAssociatedQuestionType(new CategoryQuestionDto().fromEntity(pair), category, question);
}
Can someone tell me why this method in coverage report is with red lines?
Hi to all, I use maven plugin Cobertura 2.7. I want to test the below method.
and I am testing this with the below test.
Can someone tell me why this method in coverage report is with red lines?