Author: dcosse Date: 2014-03-14 16:06:23 +0100 (Fri, 14 Mar 2014) New Revision: 3759 Url: http://forge.chorem.org/projects/lima/repository/revisions/3759 Log: fixes #828 non reproductible avec ce jeu de test et java version "1.7.0_51" Added: trunk/lima-swing/src/test/java/org/ trunk/lima-swing/src/test/java/org/chorem/ trunk/lima-swing/src/test/java/org/chorem/lima/ trunk/lima-swing/src/test/java/org/chorem/lima/ui/ trunk/lima-swing/src/test/java/org/chorem/lima/ui/account/ trunk/lima-swing/src/test/java/org/chorem/lima/ui/account/AccountViewHandlerTest.java Added: trunk/lima-swing/src/test/java/org/chorem/lima/ui/account/AccountViewHandlerTest.java =================================================================== --- trunk/lima-swing/src/test/java/org/chorem/lima/ui/account/AccountViewHandlerTest.java (rev 0) +++ trunk/lima-swing/src/test/java/org/chorem/lima/ui/account/AccountViewHandlerTest.java 2014-03-14 15:06:23 UTC (rev 3759) @@ -0,0 +1,44 @@ +package org.chorem.lima.ui.account; + +import java.util.Collections; +import java.util.List; + +import org.chorem.lima.entity.Account; +import org.chorem.lima.entity.AccountImpl; +import org.junit.Test; + +import com.google.common.collect.Lists; + +import junit.framework.Assert; + +/** + * @author David Cossé + */ +public class AccountViewHandlerTest { + @Test + public void testAccountLengthComparator() throws Exception { + +// int result = o1.getAccountNumber().length() - o2.getAccountNumber().length(); +// if (result == 0) { +// // same length, compare accountNumber +// result = o1.getAccountNumber().compareTo(o2.getAccountNumber()); +// } + + List<String> testsValues = Lists.newArrayList("", "", "", "A", "A", "A", "0", "0", "0", "00", "00", "00", "%£", "%£", " ", " "); + + List<Account> accounts = Lists.newArrayListWithCapacity(testsValues.size()); + + for (String testValue : testsValues) { + Account a = new AccountImpl(); + a.setAccountNumber(testValue); + accounts.add(a); + } + + try { + Collections.sort(accounts, AccountViewHandler.accountLengthComparator); + } catch (Exception e) { + Assert.fail(); + } + + } +}