From: SourceForge.net <no...@so...> - 2009-12-01 02:20:31
|
Feature Requests item #1565184, was opened at 2006-09-25 15:57 Message generated for change (Comment added) made by sf-robot You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=365278&aid=1565184&group_id=15278 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None >Status: Closed Resolution: None Priority: 5 Private: No Submitted By: Bruce Dunwiddie (shriop) Assigned to: Nobody/Anonymous (nobody) Summary: Allow implicit numeric casts on assertEquals Initial Comment: Currently, when checking for an expected value of a long, you must put the L after the expected value to get the assertEquals to pass. An implicit numeric conversion or wider comparison here would be nice. For example, Assert.assertEquals(0L, reader.getCurrentRecord()); would be nicer as, Assert.assertEquals(0, reader.getCurrentRecord()); ---------------------------------------------------------------------- >Comment By: SourceForge Robot (sf-robot) Date: 2009-12-01 02:20 Message: This Tracker item was closed automatically by the system. It was previously set to a Pending status, and the original submitter did not respond within 14 days (the time period specified by the administrator of this Tracker). ---------------------------------------------------------------------- Comment By: David Saff (dsaff) Date: 2009-11-16 17:52 Message: This tracker is being shut down. Please move this item to http://github.com/KentBeck/junit/issues ---------------------------------------------------------------------- Comment By: Santiago L. Valdarrama (svpino) Date: 2006-12-12 15:53 Message: Logged In: YES user_id=818352 Originator: NO The other solution is to change the signature of the assertEquals methods to something like this: static public <T> void assertEquals(String message, T expected, T actual) and update the other related methods (i.e. failNotEquals). This is really a very easy work to do. ---------------------------------------------------------------------- Comment By: Santiago L. Valdarrama (svpino) Date: 2006-12-12 15:40 Message: Logged In: YES user_id=818352 Originator: NO This behaviour is caused by the automatic boxing/autoboxing feature of jdk 1.5. If you look carefully into the details of the Assert class, you will realize that there is only one assertEquals method that receive two objects for comparison purposes (version 3.8 implements one assertEquals for each data type). This behaviour is ok for me, however, the solution will be as easy as implementing some stubs methods for each kind of type (like previous junit versions). These methods will delegate the assertion implementation to the already existing assertEquals method. Something like this: static public void assertEquals(String message, long expected, long actual) { assertEquals(message, new Long(expected), new Long(actual)); } static public void assertEquals(String message, short expected, short actual) { assertEquals(message, new Short(expected), new Short(actual)); } ... and so on... ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=365278&aid=1565184&group_id=15278 |