[Arakhnę-Dev] [208] * Fixing code according to unit tests. |
[ Thread Index |
Date Index
| More arakhne.org/dev Archives
]
Revision: 208
Author: galland
Date: 2011-02-28 09:22:26 +0100 (Mon, 28 Feb 2011)
Log Message:
-----------
* Fixing code according to unit tests.
Removed Paths:
-------------
trunk/arakhneRefs/src/test/java/org/arakhne/util/ref/WeakArrayListTest.java
Deleted: trunk/arakhneRefs/src/test/java/org/arakhne/util/ref/WeakArrayListTest.java
===================================================================
--- trunk/arakhneRefs/src/test/java/org/arakhne/util/ref/WeakArrayListTest.java 2011-02-28 08:20:55 UTC (rev 207)
+++ trunk/arakhneRefs/src/test/java/org/arakhne/util/ref/WeakArrayListTest.java 2011-02-28 08:22:26 UTC (rev 208)
@@ -1,99 +0,0 @@
-/* $Id$
- *
- * Copyright (C) 2007-09 Stéphane GALLAND
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- * This program is free software; you can redistribute it and/or modify
- */
-package org.arakhne.util.ref;
-
-import org.arakhne.junit.AbstractTestCase;
-
-/**
-* @author Stéphane GALLAND <galland@xxxxxxxxxxx>
-* @version $Name$ $Revision$ $Date$
-*/
-public class WeakArrayListTest extends AbstractTestCase {
-
- private String d1;
- private String d2;
- private String d3;
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void setUp() throws Exception {
- super.setUp();
- this.d1 = Integer.toString(0)+randomString(10);
- this.d2 = Integer.toString(1)+randomString(10);
- this.d3 = Integer.toString(2)+randomString(10);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void tearDown() throws Exception {
- this.d1 = this.d2 = this.d3;
- super.tearDown();
- }
-
- private void clearReferences() {
- this.d1 = this.d2 = this.d3 = null;
- }
-
- private WeakArrayList<String> createWeakList() {
- WeakArrayList<String> test = new WeakArrayList<String>();
- test.add(this.d1);
- test.add(this.d2);
- test.add(this.d3);
- return test;
- }
-
- private static void collect(WeakArrayList<String> list) {
- for(int j=0; j<5; j++) {
- for(int i=0; i<3; i++) {
- System.gc();
- }
- list.expurge();
- }
- }
-
- /**
- */
- public void testSize() {
- WeakArrayList<String> test = createWeakList();
- assertEquals(3, test.size());
-
- clearReferences();
- collect(test);
-
- assertEquals(0, test.size());
- }
-
- /**
- */
- public void testIsEmpty() {
- WeakArrayList<String> test = createWeakList();
- assertEquals(3, test.size());
-
- clearReferences();
- collect(test);
-
- assertTrue(test.isEmpty());
- }
-
-}