2 * Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.mdsal.binding.dom.adapter;
10 import static org.junit.Assert.assertTrue;
12 import com.google.common.collect.ClassToInstanceMap;
13 import com.google.common.collect.MutableClassToInstanceMap;
16 import org.junit.Test;
18 public class AdapterBuilderTest extends AdapterBuilder {
20 private static final ClassToInstanceMap<Object> DELEGATES = MutableClassToInstanceMap.create();
23 public void buildTest() throws Exception {
24 this.addDelegate(String.class, "test");
25 DELEGATES.putAll((Map) this.build());
26 assertTrue(DELEGATES.containsValue("test"));
27 this.addDelegate(Object.class, "test2");
28 DELEGATES.putAll((Map) this.build());
29 assertTrue(DELEGATES.containsValue("test"));
30 assertTrue(DELEGATES.get(Object.class).equals("test2"));
34 public Set<? extends Class> getRequiredDelegates() {
35 return DELEGATES.keySet();
39 protected Object createInstance(ClassToInstanceMap delegates) {