View Javadoc
1   /*
2    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
3    * The software in this package is published under the terms of the CPAL v1.0
4    * license, a copy of which has been included with this distribution in the
5    * LICENSE.txt file.
6    */
7   package org.mule.registry;
8   
9   import org.mule.api.registry.RegistrationException;
10  import org.mule.api.registry.Registry;
11  import org.mule.tck.junit4.AbstractMuleContextTestCase;
12  
13  import java.io.IOException;
14  import java.util.Collection;
15  import java.util.Map;
16  
17  import org.junit.Test;
18  
19  import static org.junit.Assert.assertEquals;
20  import static org.junit.Assert.assertNotNull;
21  import static org.junit.Assert.assertNull;
22  
23  public abstract class AbstractRegistryTestCase extends AbstractMuleContextTestCase
24  {
25      public abstract Registry getRegistry();
26  
27      @Test
28      public void testNotFoundCalls() throws RegistrationException
29      {
30          Registry r = getRegistry();
31          Map<String, IOException> map = r.lookupByType(IOException.class);
32          assertNotNull(map);
33          assertEquals(0, map.size());
34  
35          IOException object = r.lookupObject(IOException.class);
36          assertNull(object);
37  
38          object = r.lookupObject("foooooo");
39          assertNull(object);
40  
41          Collection<IOException> list = r.lookupObjects(IOException.class);
42          assertNotNull(list);
43          assertEquals(0, list.size());
44      }
45  }