View Javadoc

1   /*
2    * $Id: SimpleMemoryObjectStoreContractTestCase.java 22387 2011-07-12 03:53:36Z dirk.olmes $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
5    *
6    * The software in this package is published under the terms of the CPAL v1.0
7    * license, a copy of which has been included with this distribution in the
8    * LICENSE.txt file.
9    */
10  
11  package org.mule.util.store;
12  
13  import org.mule.api.store.ObjectStore;
14  import org.mule.api.store.ObjectStoreException;
15  import org.mule.tck.testmodels.fruit.Banana;
16  
17  import java.io.Serializable;
18  
19  import static org.junit.Assert.fail;
20  
21  public class SimpleMemoryObjectStoreContractTestCase extends AbstractObjectStoreContractTestCase
22  {
23      @Override
24      public ObjectStore<Serializable> getObjectStore()
25      {
26          return new SimpleMemoryObjectStore<Serializable>();
27      }
28  
29      @Override
30      public Serializable getStorableValue()
31      {
32          return new Banana();
33      }
34  
35      public void testStoreNullValue() throws Exception
36      {
37          try
38          {
39              getObjectStore().store("key", null);
40              fail("store() called with null value must throw ObjectStoreException");
41          }
42          catch (ObjectStoreException ose)
43          {
44              // this one was expected
45          }
46      }
47  }