froehlich 02/01/20 06:25:41 Added: simplestore/src/test/org/apache/commons/simplestore TestSoftRefMemoryStore.java Log: added new test case Revision Changes Path 1.1 jakarta-commons-sandbox/simplestore/src/test/org/apache/commons/simplestore/TestSoftRefMemoryStore.java Index: TestSoftRefMemoryStore.java =================================================================== /***************************************************************************** * Copyright (C) The Apache Software Foundation. All rights reserved. * * ------------------------------------------------------------------------- * * This software is published under the terms of the Apache Software License * * version 1.1, a copy of which has been included with this distribution in * * the LICENSE file. * *****************************************************************************/ package org.apache.commons.simplestore; import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; import java.util.Map; import java.util.HashMap; /** * @author Gerhard Froehlich <a href="mailto:[EMAIL PROTECTED]"> * [EMAIL PROTECTED]</a> * @version $Id: TestSoftRefMemoryStore.java,v 1.1 2002/01/20 14:25:41 froehlich Exp $ */ public class TestSoftRefMemoryStore extends TestMap { public TestSoftRefMemoryStore(String testName) { super(testName); } public static Test suite() { return new TestSuite(TestSoftRefMemoryStore.class); } public static void main(String args[]) { String[] testCaseName = { TestSoftRefMemoryStore.class.getName() }; junit.textui.TestRunner.main(testCaseName); } public Map makeMap() { MRUMemoryStore mrustore = new MRUMemoryStore(10); SoftRefMemoryStore store = new SoftRefMemoryStore(mrustore,10); return store; } public void setUp() { map = makeMap(); } public void testNewMap() { assertTrue("New map is empty", map.isEmpty()); assertEquals("New map has size zero", map.size(), 0); } public void testSearch() { System.out.println("Testing MRUMemoryStore with WeakReferences"); map.put("first", "First Item"); map.put("second", "Second Item"); assertEquals("Top item is 'Second Item'", map.get("first"), "First Item"); assertEquals("Next Item is 'First Item'", map.get("second"), "Second Item"); } }
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>