PullFeeder sends an addition "MODE READER" to peers.
3 * see AUTHORS for the list of contributors
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 package test.unit.util;
21 import junit.framework.TestCase;
22 import org.sonews.util.TimeoutMap;
25 * Unit test for class org.sonews.util.TimeoutMap.
26 * @author Christian Lins
28 * @see org.sonews.util.TimeoutMap
30 public class TimeoutMapTest extends TestCase
33 public TimeoutMapTest()
35 super("TimeoutMapTest");
38 public void testTimeoutBehaviour()
40 TimeoutMap<String, Object> tm = new TimeoutMap<String, Object>(1000);
41 Object testobj = new Object();
43 tm.put("testkey", testobj);
45 assertNotNull(tm.get("testkey"));
46 assertTrue(tm.containsKey("testkey"));
47 assertTrue(tm.contains(testobj));
53 catch(InterruptedException ex) { ex.printStackTrace(); }
55 assertNotNull(tm.get("testkey"));
56 assertTrue(tm.containsKey("testkey"));
57 assertTrue(tm.contains(testobj));
63 catch(InterruptedException ex) { ex.printStackTrace(); }
65 assertNull(tm.get("testkey"));
66 assertFalse(tm.containsKey("testkey"));
67 assertFalse(tm.contains(testobj));