Rather than using subclasses for initialization, which require a serial
version, populate them normally -- thus fixing warnings.
Change-Id: Ia204b3ed6a58acaee1de2f1d780a9421cd0eea8f
Signed-off-by: Robert Varga <rovarga@cisco.com>
final String jspFilter = "jspFilter";
final String exactMatch = "/somePath";
final String prefixFilter = "prefixFilter";
final String jspFilter = "jspFilter";
final String exactMatch = "/somePath";
final String prefixFilter = "prefixFilter";
- LinkedHashMap<String, String> patternMap = new LinkedHashMap<String, String>() {
- {
- put(exactMatch, exactMatchFilter);
- put("/*", defaultFilter);
- put("*.jsp", jspFilter);
- put("/foo/*", prefixFilter);
- }
- };
+ LinkedHashMap<String, String> patternMap = new LinkedHashMap<>();
+ patternMap.put(exactMatch, exactMatchFilter);
+ patternMap.put("/*", defaultFilter);
+ patternMap.put("*.jsp", jspFilter);
+ patternMap.put("/foo/*", prefixFilter);
urlMatcher = new UrlMatcher<>(patternMap);
assertMatches("/abc", defaultFilter);
assertMatches(exactMatch, exactMatchFilter, defaultFilter);
urlMatcher = new UrlMatcher<>(patternMap);
assertMatches("/abc", defaultFilter);
assertMatches(exactMatch, exactMatchFilter, defaultFilter);
private DataNormalizer mockNormalizer() throws DataNormalizationException {
final DataNormalizer mock = mock(DataNormalizer.class);
private DataNormalizer mockNormalizer() throws DataNormalizationException {
final DataNormalizer mock = mock(DataNormalizer.class);
- doReturn(new AbstractMap.SimpleEntry<YangInstanceIdentifier, NormalizedNode<?, ?>>(id, normalizedNode) {})
+ doReturn(new AbstractMap.SimpleEntry<YangInstanceIdentifier, NormalizedNode<?, ?>>(id, normalizedNode))
.when(mock).toNormalized(any(YangInstanceIdentifier.class), any(CompositeNode.class));
doReturn(compositeNode).when(mock).toLegacy(any(YangInstanceIdentifier.class), any(NormalizedNode.class));
doReturn(id).when(mock).toLegacy(any(YangInstanceIdentifier.class));
.when(mock).toNormalized(any(YangInstanceIdentifier.class), any(CompositeNode.class));
doReturn(compositeNode).when(mock).toLegacy(any(YangInstanceIdentifier.class), any(NormalizedNode.class));
doReturn(id).when(mock).toLegacy(any(YangInstanceIdentifier.class));
package org.opendaylight.controller.netconf.confignetconfconnector.operations.runtimerpc;
import static org.junit.Assert.assertEquals;
package org.opendaylight.controller.netconf.confignetconfconnector.operations.runtimerpc;
import static org.junit.Assert.assertEquals;
+import com.google.common.collect.ImmutableMap;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
return Arrays.asList(new Object[][] {
// With namespaces
{ "/a:modules/a:module[a:name='instanceName'][a:type='moduleType']/b:listener-state[b:peer-id='127.0.0.1']",
return Arrays.asList(new Object[][] {
// With namespaces
{ "/a:modules/a:module[a:name='instanceName'][a:type='moduleType']/b:listener-state[b:peer-id='127.0.0.1']",
- new HashMap<String, String>() {{
- put("listener-state", "127.0.0.1");
- }}},
+ new HashMap<>(ImmutableMap.of("listener-state", "127.0.0.1"))},
{ "/a:modules/a:module[a:name='instanceName'][a:type='moduleType']",
null},
{ "/a:modules/a:module[a:name='instanceName'][a:type='moduleType']",
null},
{ "/modules/module[name=instanceName and type=moduleType]/inner[key=\"b\"]", Collections.singletonMap("inner", "b")},
{ "/modules/module[name=instanceName and type=\"moduleType\"]/inner[key2=a]/inner2[key=b]",
{ "/modules/module[name=instanceName and type=moduleType]/inner[key=\"b\"]", Collections.singletonMap("inner", "b")},
{ "/modules/module[name=instanceName and type=\"moduleType\"]/inner[key2=a]/inner2[key=b]",
- new HashMap<String, String>() {{
- put("inner", "a");
- put("inner2", "b");
- }}
+ new HashMap<>(ImmutableMap.of("inner", "a", "inner2", "b"))