Return-Path: Delivered-To: apmail-commons-commits-archive@minotaur.apache.org Received: (qmail 77767 invoked from network); 22 Apr 2010 13:11:32 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 22 Apr 2010 13:11:32 -0000 Received: (qmail 51332 invoked by uid 500); 22 Apr 2010 13:11:32 -0000 Delivered-To: apmail-commons-commits-archive@commons.apache.org Received: (qmail 51254 invoked by uid 500); 22 Apr 2010 13:11:31 -0000 Mailing-List: contact commits-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@commons.apache.org Delivered-To: mailing list commits@commons.apache.org Received: (qmail 51247 invoked by uid 99); 22 Apr 2010 13:11:31 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 22 Apr 2010 13:11:31 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 22 Apr 2010 13:11:28 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id E36E423889D7; Thu, 22 Apr 2010 13:10:45 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r936824 - in /commons/proper/net/branches/NET_2_0/src/test/java/org/apache/commons/net: ntp/TimeStampTest.java pop3/POP3ClientCommandsTest.java telnet/TelnetClientTest.java time/TimeTCPClientTest.java Date: Thu, 22 Apr 2010 13:10:45 -0000 To: commits@commons.apache.org From: sebb@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20100422131045.E36E423889D7@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: sebb Date: Thu Apr 22 13:10:45 2010 New Revision: 936824 URL: http://svn.apache.org/viewvc?rev=936824&view=rev Log: assertEquals gives more info than assertTrue on failure Modified: commons/proper/net/branches/NET_2_0/src/test/java/org/apache/commons/net/ntp/TimeStampTest.java commons/proper/net/branches/NET_2_0/src/test/java/org/apache/commons/net/pop3/POP3ClientCommandsTest.java commons/proper/net/branches/NET_2_0/src/test/java/org/apache/commons/net/telnet/TelnetClientTest.java commons/proper/net/branches/NET_2_0/src/test/java/org/apache/commons/net/time/TimeTCPClientTest.java Modified: commons/proper/net/branches/NET_2_0/src/test/java/org/apache/commons/net/ntp/TimeStampTest.java URL: http://svn.apache.org/viewvc/commons/proper/net/branches/NET_2_0/src/test/java/org/apache/commons/net/ntp/TimeStampTest.java?rev=936824&r1=936823&r2=936824&view=diff ============================================================================== --- commons/proper/net/branches/NET_2_0/src/test/java/org/apache/commons/net/ntp/TimeStampTest.java (original) +++ commons/proper/net/branches/NET_2_0/src/test/java/org/apache/commons/net/ntp/TimeStampTest.java Thu Apr 22 13:10:45 2010 @@ -41,7 +41,7 @@ public class TimeStampTest extends TestC // do assertion tests on TimeStamp class assertEquals("equals(1,2)", ts1, ts2); - assertTrue("compareTo(1,2)", ts1.compareTo(ts2) == 0); + assertEquals("compareTo(1,2)", 0, ts1.compareTo(ts2)); assertEquals("ntpValue(1,2)", ts1.ntpValue(), ts2.ntpValue()); assertEquals("hashCode(1,2)", ts1.hashCode(), ts2.hashCode()); assertEquals("ts1==ts1", ts1, ts1); @@ -50,7 +50,7 @@ public class TimeStampTest extends TestC // fraction of a second (~200 picoseconds) so the times are not equal but // when converted to Java dates (in milliseconds) they will be equal. assertTrue("ts1 != ts3", !ts1.equals(ts3)); - assertTrue("compareTo(1,3)", ts1.compareTo(ts3) == -1); + assertEquals("compareTo(1,3)", -1, ts1.compareTo(ts3)); assertEquals("seconds", ts1.getSeconds(), ts3.getSeconds()); assertTrue("fraction", ts1.getFraction() != ts3.getFraction()); assertTrue("ntpValue(1,3)", ts1.ntpValue() != ts3.ntpValue()); Modified: commons/proper/net/branches/NET_2_0/src/test/java/org/apache/commons/net/pop3/POP3ClientCommandsTest.java URL: http://svn.apache.org/viewvc/commons/proper/net/branches/NET_2_0/src/test/java/org/apache/commons/net/pop3/POP3ClientCommandsTest.java?rev=936824&r1=936823&r2=936824&view=diff ============================================================================== --- commons/proper/net/branches/NET_2_0/src/test/java/org/apache/commons/net/pop3/POP3ClientCommandsTest.java (original) +++ commons/proper/net/branches/NET_2_0/src/test/java/org/apache/commons/net/pop3/POP3ClientCommandsTest.java Thu Apr 22 13:10:45 2010 @@ -131,8 +131,8 @@ public class POP3ClientCommandsTest exte connect(); assertTrue(p.login(emptyUser, password)); POP3MessageInfo msg2 = p.status(); - assertTrue(msg2.number == 0); - assertTrue(msg2.size == 0); + assertEquals(0, msg2.number); + assertEquals(0, msg2.size); assertNull(msg2.identifier); p.logout(); @@ -160,7 +160,7 @@ public class POP3ClientCommandsTest exte for(int i = 0; i < msg.length; i++) { assertNotNull(msg[i]); - assertTrue(msg[i].number == i + 1); + assertEquals(i+1, msg[i].number); assertTrue(msg[i].size > 0); assertNull(msg[i].identifier); } @@ -184,7 +184,7 @@ public class POP3ClientCommandsTest exte //The first message is always at index 1 POP3MessageInfo msg = p.listMessage(1); assertNotNull(msg); - assertTrue(msg.number == 1); + assertEquals(1, msg.number); assertTrue(msg.size > 0); assertNull(msg.identifier); @@ -217,7 +217,7 @@ public class POP3ClientCommandsTest exte assertTrue(p.login(emptyUser, password)); POP3MessageInfo[] msg = p.listMessages(); - assertTrue(msg.length == 0); + assertEquals(0, msg.length); //Now test from the update state p.setState(POP3.UPDATE_STATE); @@ -256,7 +256,7 @@ public class POP3ClientCommandsTest exte for(int i = 0; i < msg.length; i++) { assertNotNull(msg[i]); - assertTrue(msg[i].number == i + 1); + assertEquals(i + 1, msg[i].number); assertNotNull(msg[i].identifier); } @@ -279,7 +279,7 @@ public class POP3ClientCommandsTest exte //The first message is always at index 1 POP3MessageInfo msg = p.listUniqueIdentifier(1); assertNotNull(msg); - assertTrue(msg.number == 1); + assertEquals(1, msg.number); assertNotNull(msg.identifier); //Now retrieve a message from index 0 @@ -311,7 +311,7 @@ public class POP3ClientCommandsTest exte assertTrue(p.login(emptyUser, password)); POP3MessageInfo[] msg = p.listUniqueIdentifiers(); - assertTrue(msg.length == 0); + assertEquals(0, msg.length); //Now test from the update state p.setState(POP3.UPDATE_STATE); Modified: commons/proper/net/branches/NET_2_0/src/test/java/org/apache/commons/net/telnet/TelnetClientTest.java URL: http://svn.apache.org/viewvc/commons/proper/net/branches/NET_2_0/src/test/java/org/apache/commons/net/telnet/TelnetClientTest.java?rev=936824&r1=936823&r2=936824&view=diff ============================================================================== --- commons/proper/net/branches/NET_2_0/src/test/java/org/apache/commons/net/telnet/TelnetClientTest.java (original) +++ commons/proper/net/branches/NET_2_0/src/test/java/org/apache/commons/net/telnet/TelnetClientTest.java Thu Apr 22 13:10:45 2010 @@ -565,10 +565,10 @@ extends TestCase implements TelnetNotifi } - assertTrue(numdo == 2); - assertTrue(numdont == 1); - assertTrue(numwont == 1); - assertTrue(numwill == 0); + assertEquals(2, numdo); + assertEquals(1, numdont); + assertEquals(1, numwont); + assertEquals(0, numwill); } Modified: commons/proper/net/branches/NET_2_0/src/test/java/org/apache/commons/net/time/TimeTCPClientTest.java URL: http://svn.apache.org/viewvc/commons/proper/net/branches/NET_2_0/src/test/java/org/apache/commons/net/time/TimeTCPClientTest.java?rev=936824&r1=936823&r2=936824&view=diff ============================================================================== --- commons/proper/net/branches/NET_2_0/src/test/java/org/apache/commons/net/time/TimeTCPClientTest.java (original) +++ commons/proper/net/branches/NET_2_0/src/test/java/org/apache/commons/net/time/TimeTCPClientTest.java Thu Apr 22 13:10:45 2010 @@ -58,7 +58,7 @@ public class TimeTCPClientTest extends T calendar.set(Calendar.MILLISECOND, 0); long baseTime = calendar.getTime().getTime() / 1000L; - assertTrue(baseTime == -TimeTCPClient.SECONDS_1900_TO_1970); + assertEquals(baseTime, -TimeTCPClient.SECONDS_1900_TO_1970); } /***