logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Remko Popma <remko.po...@gmail.com>
Subject Re: svn commit: r1596439 - /logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/net/ssl/KeyStoreConfigurationTest.java
Date Wed, 21 May 2014 06:31:43 GMT
Ah I see. The commit mail didn't show the @Test(expected=...Exception) line. 

Sent from my iPhone

> On 2014/05/21, at 13:37, Gary Gregory <garydgregory@gmail.com> wrote:
> 
>> On Tue, May 20, 2014 at 11:57 PM, Remko Popma <remko.popma@gmail.com> 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, ggregory@apache.org 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: log4j-dev-unsubscribe@logging.apache.org
>> For additional commands, e-mail: log4j-dev-help@logging.apache.org
> 
> 
> 
> -- 
> E-Mail: garydgregory@gmail.com | ggregory@apache.org 
> Java Persistence with Hibernate, Second Edition
> JUnit in Action, Second Edition
> Spring Batch in Action
> Blog: http://garygregory.wordpress.com 
> Home: http://garygregory.com/
> Tweet! http://twitter.com/GaryGregory

Mime
View raw message