add calculateUsingFactory test case

This commit is contained in:
张尚渝 2019-03-12 19:11:40 +08:00
parent 2cdae3f8b9
commit 83d82a6574
1 changed files with 7 additions and 0 deletions

View File

@ -29,4 +29,11 @@ public class CalculatorUnitTest {
int result = calculator.calculate(new AddCommand(3, 7)); int result = calculator.calculate(new AddCommand(3, 7));
assertEquals(10, result); assertEquals(10, result);
} }
@Test
public void whenCalculateUsingFactory_thenReturnCorrectResult() {
Calculator calculator = new Calculator();
int result = calculator.calculateUsingFactory(3, 4, "add");
assertEquals(7, result);
}
} }