On Tue, May 20, 2014 at 11:57 PM, Remko Popma <[email protected]> wrote:
> Shouldn't that assert really have been:
> Assert.fail("Should not get here!");
>
> because we expect to fail earlier with the wrong password?
> (And then we should keep the assert, no?)
>
Nope, see the definition of @Test#expected, if the method does not throw
the given _expected_ throwable, then the test will fail.
See what happens when you run:
@Test(expected = StoreConfigurationException.class)
public void boo() throws StoreConfigurationException {
// nothing.
}
Gary
>
> Sent from my iPhone
>
> > On 2014/05/21, at 11:00, [email protected] wrote:
> >
> > Author: ggregory
> > Date: Wed May 21 02:00:35 2014
> > New Revision: 1596439
> >
> > URL: http://svn.apache.org/r1596439
> > Log:
> > Remove unnecessary Assert because @Test uses the expected attribute.
> >
> > Modified:
> >
>
> logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/net/ssl/KeyStoreConfigurationTest.java
> >
> > Modified:
> logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/net/ssl/KeyStoreConfigurationTest.java
> > URL:
> http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/net/ssl/KeyStoreConfigurationTest.java?rev=1596439&r1=1596438&r2=1596439&view=diff
> >
> ==============================================================================
> > ---
> logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/net/ssl/KeyStoreConfigurationTest.java
> (original)
> > +++
> logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/net/ssl/KeyStoreConfigurationTest.java
> Wed May 21 02:00:35 2014
> > @@ -48,6 +48,5 @@ public class KeyStoreConfigurationTest {
> > public void wrongPassword() throws StoreConfigurationException {
> > KeyStoreConfiguration ksc = new
> KeyStoreConfiguration(TestConstants.KEYSTORE_FILE, "wrongPassword!");
> > KeyStore ks = ksc.getKeyStore();
> > - Assert.assertTrue(false);
> > }
> > }
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>
--
E-Mail: [email protected] | [email protected]
Java Persistence with Hibernate, Second Edition<http://www.manning.com/bauer3/>
JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
Spring Batch in Action <http://www.manning.com/templier/>
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory