I am testing a program as part of a college assignment, i have tested some methods that return a Boolean to see if they are correct, im wondering is it standard practice to check void methods with JUnit? or is there another way.I will post one of the methods here as an example. Thanks
It is a quiz game program and this method accepts an int, which is defining the year the questions will be selected from.if statements then check the year passed in and sets the questions from a question class(that are defined as objects) not sure whether you need to know that or not to answer my question.
Thanks
public GamePlay(int decade)
{
this();
questions = null;
if(decade== 1960)
{
questions = Questions.QuestionSetFrom60s();
}
else if(decade== 1970)
{
questions = Questions.QuestionSetFrom70s();
}
else if(decade== 1980)
{
questions = Questions.QuestionSetFrom80s();
}
else if(decade== 1990)
{
questions = Questions.QuestionSetFrom90s();
}
else if(decade== 2000)
{
questions = Questions.QuestionSetFrom2000s();
}
else if(decade== 2010)
{
questions = Questions.QuestionSetFrom2010s();
}
ImageIcon pic = new ImageIcon(questions[questionIndex].mediaFilePath);
lblMediaPlayer.setIcon(pic);
questionIndex = 0;
lblDisplayQuestion.setText(questions[questionIndex].textQuestion);
}
Aucun commentaire:
Enregistrer un commentaire