I am testing the function of my calculator:
//Calculator.java (Pseudo)
parameter 1: int
parameter 2: int
parameter 3: a random number generator 0-3 (0:add, 1:subtract, 2:multiply, 3:divide)
sample: parameter1 (random parameter 3) parameter2
Now, I am having problems in assert because of the parameter 3 (random). Here is my sample code:
//TestCalculator.java
@Test
public void testCalculate() {
Calculator test = new Calculator();
int resultCalculate = test.calculate(2, 2);
actual = //<how can i get the parameter 3 in here to compute the actual result>
assertEquals(actual, resultCalculate);
}
I can't input a static value in assert, I need to get the value of random first. Help!
Aucun commentaire:
Enregistrer un commentaire