001/** 002 * Logback: the reliable, generic, fast and flexible logging framework. 003 * Copyright (C) 1999-2015, QOS.ch. All rights reserved. 004 * 005 * This program and the accompanying materials are dual-licensed under 006 * either the terms of the Eclipse Public License v1.0 as published by 007 * the Eclipse Foundation 008 * 009 * or (per the licensee's choosing) 010 * 011 * under the terms of the GNU Lesser General Public License version 2.1 012 * as published by the Free Software Foundation. 013 */ 014package ch.qos.logback.core.joran.spi; 015 016import static org.junit.Assert.assertEquals; 017import static org.junit.Assert.assertNull; 018 019 020import org.junit.After; 021import org.junit.Before; 022import org.junit.Test; 023 024import ch.qos.logback.core.joran.util.House; 025import ch.qos.logback.core.joran.util.Window; 026 027public class DefaultNestedComponentRegistryTest { 028 029 DefaultNestedComponentRegistry registry = new DefaultNestedComponentRegistry(); 030 031 @Before 032 public void setUp() throws Exception { 033 034 } 035 036 @After 037 public void tearDown() throws Exception { 038 } 039 040 @Test 041 public void smoke() { 042 String propertyName = "window"; 043 registry.add(House.class, propertyName, Window.class); 044 Class<?> result = registry.findDefaultComponentType(House.class, propertyName); 045 assertEquals(Window.class, result); 046 } 047 048 @Test 049 public void absent() { 050 registry.add(House.class, "a", Window.class); 051 Class<?> result = registry.findDefaultComponentType(House.class, "other"); 052 assertNull(result); 053 } 054}