Correct ActionProviderService method definition
[mdsal.git] / binding / mdsal-binding-dom-adapter / src / test / java / org / opendaylight / mdsal / binding / dom / adapter / AdapterBuilderTest.java
1 /*
2  * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.mdsal.binding.dom.adapter;
9
10 import static org.junit.Assert.assertTrue;
11
12 import com.google.common.collect.ClassToInstanceMap;
13 import com.google.common.collect.MutableClassToInstanceMap;
14 import java.util.Map;
15 import java.util.Set;
16 import org.junit.Test;
17
18 public class AdapterBuilderTest extends AdapterBuilder {
19
20     private static final ClassToInstanceMap<Object> DELEGATES = MutableClassToInstanceMap.create();
21
22     @Test
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"));
31     }
32
33     @Override
34     public Set<? extends Class<?>> getRequiredDelegates() {
35         return DELEGATES.keySet();
36     }
37
38     @Override
39     protected Object createInstance(final ClassToInstanceMap delegates) {
40         return delegates;
41     }
42 }