Is using Assert.assertTrue(true); and assert Assert.fail(); good practise in JUnit testing?
<p>Is this good or bad practise of using Assert.assertTrue(true); and Assert.fail() in JUnit testing and why? <br />
<br />
I know there is also rule @Test (expected = Exception.class), but you can have more more than one exception which can be raised on tested method and if you don't want to have zillion testing methods for one tested method, this could be option. <br />
<br />
<strong>The usecase is this:</strong> You test method which can raise zero, one or more exception (in example to make it simple just one) and you want to test case that the call is ok so no exception should be raised and if you get into catch block you will raise Assert.fail(); then you want test case when exception should be raised, so you call in catch block Assert.assertTrue(true); to say "Yeah this is what I wanted". And from the test you can see in one test method when it should fail and when you run the test if its really behave like you want to. <br />
<strong>Question is: Is this good or bad practise? Why?</strong> <br /></p>

<pre><code>public void fooMethod(boolean paramenter) {
  if(false) {
    throw new Exception();
  }
}

@Test
public void testFooMethod() {

  try {
     myTestedClassMock.fooMethod(true); //should not raise exception
  } catch(Exception e) {
    Assert.fail();
  }  

  try {
    myTestedClassMock.fooMethod(false); //should raise exception
  } catch (Exception e) {
     Assert.assertTrue(true);
  }

}
</code></pre>