/* * ==================================================================== * Copyright (c) 2005-2012 sventon project. All rights reserved. * * This software is licensed as described in the file LICENSE, which * you should have received as part of this distribution. The terms * are also available at http://www.sventon.org. * If newer versions of this license are posted there, you may use a * newer version instead, at your option. * ==================================================================== */ package org.sventon.cache.objectcache; import org.junit.Test; import static org.junit.Assert.fail; public class DefaultObjectCacheTest { private ObjectCache createMemoryCache() throws Exception { return new DefaultObjectCache("sventonTestCache", null, 1000, false, false, 0, 0, false, 0); } @Test public void testPutNull() throws Exception { ObjectCache cache = createMemoryCache(); try { cache.put(null, null); fail("Should cause IllegalArgumentException"); } catch (IllegalArgumentException npe) { // expected } cache.shutdown(); } @Test public void testGetNull() throws Exception { ObjectCache cache = createMemoryCache(); try { cache.get(null); fail("Should cause IllegalArgumentException"); } catch (IllegalArgumentException npe) { // expected } cache.shutdown(); } }