I was messing arround with JUnit @Theory
and find out that assumeTrue(false)
fails the theory instrad if ignore it.
This code fail the test:
@RunWith(Theories.class)
public class SnippetTest {
@Theory
public void validateIndices(){
assumeTrue(false);
}
}
SnippetTest.validateIndices Never found parameters that satisfied method assumptions. Violated assumptions: [org.junit.AssumptionViolatedException: got: false, expected: is true]
But when I'm using @Test assumption ignore it.
public class SnippetTest {
@Test
public void validateIndices() {
assumeTrue(false);
}
}
It's contraversial with Theories Documentation.
If any of the assumptions fail, the data point is silently ignored.
What am I missing or what am doing wrong?
Thanks to @TamasRev comment I found what was going wrong. Looks like, it will fail the test in case all the the assumption fails. Im the case I posted, I have only one assumption. What is happening if I'm using
@DataPoints
? This one fails as wellBut when if at least one assumption pass then test is not failed.
Thanx @TamasRev for pointing me to right direction.