View Javadoc

1   /*
2    * $Id: AbstractRegistryTestCase.java 22377 2011-07-11 12:41:42Z 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  package org.mule.registry;
11  
12  import org.mule.api.registry.RegistrationException;
13  import org.mule.api.registry.Registry;
14  import org.mule.tck.junit4.AbstractMuleContextTestCase;
15  
16  import java.io.IOException;
17  import java.util.Collection;
18  import java.util.Map;
19  
20  import org.junit.Test;
21  
22  import static org.junit.Assert.assertEquals;
23  import static org.junit.Assert.assertNotNull;
24  import static org.junit.Assert.assertNull;
25  
26  public abstract class AbstractRegistryTestCase extends AbstractMuleContextTestCase
27  {
28      public abstract Registry getRegistry();
29  
30      @Test
31      public void testNotFoundCalls() throws RegistrationException
32      {
33          Registry r = getRegistry();
34          Map<String, IOException> map = r.lookupByType(IOException.class);
35          assertNotNull(map);
36          assertEquals(0, map.size());
37  
38          IOException object = r.lookupObject(IOException.class);
39          assertNull(object);
40  
41          object = r.lookupObject("foooooo");
42          assertNull(object);
43  
44          Collection<IOException> list = r.lookupObjects(IOException.class);
45          assertNotNull(list);
46          assertEquals(0, list.size());
47      }
48  }