You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by Remko Popma <re...@gmail.com> on 2014/05/21 05:57:00 UTC
Re: svn commit: r1596439 - /logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/net/ssl/KeyStoreConfigurationTest.java
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?)
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
Re: svn commit: r1596439 - /logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/net/ssl/KeyStoreConfigurationTest.java
Posted by Remko Popma <re...@gmail.com>.
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 <ga...@gmail.com> wrote:
>
>> On Tue, May 20, 2014 at 11:57 PM, Remko Popma <re...@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
Re: svn commit: r1596439 - /logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/net/ssl/KeyStoreConfigurationTest.java
Posted by Gary Gregory <ga...@gmail.com>.
On Tue, May 20, 2014 at 11:57 PM, Remko Popma <re...@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<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