I have this method in my Beginning class
@Override
public void question() {
String question = String.format(TEXT_OF_A_QUESTION, this.namePlate);
int answer = JOptionPane.showConfirmDialog(null, question, "Question", JOptionPane.YES_NO_OPTION);
if (Integer.valueOf(answer).equals(JOptionPane.YES_OPTION)) {
this.positive.positiveAnswer();
} else {
this.negative.negativeAnswer(this);
}
}
How do I create a unit test to test this method? I'm trying to get problems because my model is an interface as you can see below;
package com.test.wladimir.gamergourmet.model;
public interface Plate {
String namePlate();
void question();
void questionLevel(String positiveAnswer, String negativeAnswer);
void positiveAnswer();
void negativeAnswer(Plate plate);
}
This is my APPLICATION
This was my attempt;
@RunWith(MockitoJUnitRunner.Silent.class)
public class BeginningTest {
private static final String TEXT_OF_A_QUESTION = "O prato que você pensou é %s?";
private static String namePlate = "torta";
private Plate positive;
private Plate negative;
@Mock
private Beginning beginningController;
@Before
public void setUp() {
beginningController = new Beginning(namePlate);
}
@Test
public void testQuestion() {
String question = String.format(TEXT_OF_A_QUESTION, this.namePlate);
assertThat(question, notNullValue());
}
But I do not know if I'm right!