1   package ch.qos.logback.core.joran.spi;
2   
3   import static org.junit.Assert.assertEquals;
4   import static org.junit.Assert.assertNull;
5   
6   import org.junit.After;
7   import org.junit.Before;
8   import org.junit.Test;
9   
10  public class DefaultNestedComponentRegistryTest {
11  
12    DefaultNestedComponentRegistry registry = new DefaultNestedComponentRegistry();
13  
14    @Before
15    public void setUp() throws Exception {
16  
17    }
18  
19    @After
20    public void tearDown() throws Exception {
21    }
22  
23    @Test
24    public void smoke() {
25      String propertyName = "window";
26      registry.add(House.class, propertyName, Window.class);
27      Class result = registry.findDefaultComponentType(House.class, propertyName);
28      assertEquals(Window.class, result);
29    }
30  
31    @Test
32    public void absent() {
33      registry.add(House.class, "a", Window.class);
34      Class result = registry.findDefaultComponentType(House.class, "other");
35      assertNull(result);
36    }
37  }