I need to write a JUnit test case which would test a function passing different permutations,with corresponding results.
A successful used case returns nothing ,while a failed permutation throws exception(exception type wouldnt matter).
eg. testAppleisSweetAndRed(fruit,colour,taste)
The test would invoke the following -
testAppleisSweetAndRed(orange,red,sweet)//throws exception
testAppleisSweetAndRed(apple,green,sweet)//throws exception
testAppleisSweetAndRed(apple,red,sour)//throws exception
testAppleisSweetAndRed(apple,red,sweet)//OK
If the invocations behave as expected,the test succeeds.
How would an assert trap the first 3 invocations to ensure they do raise expected exception?