package org.opendaylight.controller.config.api;
+import static org.mockito.Mockito.doNothing;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
import org.junit.Assert;
import org.junit.Test;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-import org.opendaylight.controller.config.api.annotations.AbstractServiceInterface;
import org.opendaylight.yangtools.yang.binding.BaseIdentity;
-import javax.management.*;
-
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.*;
-
public class IdentityAttributeRefTest {
IdentityAttributeRef attr = new IdentityAttributeRef("attr");
package org.opendaylight.controller.config.api;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertThat;
+import com.google.common.collect.Lists;
import java.nio.file.AccessDeniedException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
-
-import com.google.common.collect.Lists;
import org.hamcrest.CoreMatchers;
-import org.junit.Assert;
-import org.junit.Before;
import org.junit.Test;
-import javax.management.Query;
-
-import static org.junit.Assert.*;
-
public class JmxAttributeValidationExceptionTest {
- private JmxAttribute jmxAttribute = new JmxAttribute("attr1");
+ private final JmxAttribute jmxAttribute = new JmxAttribute("attr1");
@Test
public void testJmxAttributeValidationExceptionElement() throws Exception {
@Test
public void testJmxAttributeValidationExceptionList() throws Exception {
- List attributeNames = new ArrayList<JmxAttribute>();
+ List<JmxAttribute> attributeNames = new ArrayList<>();
attributeNames.add(new JmxAttribute("att1"));
attributeNames.add(new JmxAttribute("att2"));
attributeNames.add(new JmxAttribute("att3"));
@Test
public void testJmxAttributeValidationExceptionList2() throws Exception {
- List attributeNames = new ArrayList<JmxAttribute>();
+ List<JmxAttribute> attributeNames = new ArrayList<>();
attributeNames.add(new JmxAttribute("att1"));
attributeNames.add(new JmxAttribute("att2"));
attributeNames.add(new JmxAttribute("att3"));
JmxAttributeValidationException.checkCondition(false, "message", jmxAttribute);
}
- private void assertJmxEx(JmxAttributeValidationException e, String message, JmxAttribute... attrNames) {
+ private void assertJmxEx(final JmxAttributeValidationException e, final String message, final JmxAttribute... attrNames) {
assertEquals(message, e.getMessage());
assertEquals(Lists.newArrayList(attrNames), e.getAttributeNames());
}
package org.opendaylight.controller.config.api;
-import junit.framework.Assert;
-import org.junit.Test;
-
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotEquals;
+import org.junit.Test;
public class ModuleIdentifierTest {
String fact = new String("factory");
package org.opendaylight.controller.config.api;
-import static junit.framework.Assert.assertEquals;
-import static junit.framework.Assert.assertTrue;
-import static junit.framework.Assert.fail;
-import static org.junit.Assert.assertNotEquals;
+import static org.hamcrest.CoreMatchers.containsString;
+import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat;
-import static org.junit.matchers.JUnitMatchers.containsString;
-
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
import com.google.common.collect.Lists;
import java.util.Map;
-
import org.junit.Assert;
import org.junit.Test;
public class ValidationExceptionTest {
- private String instance = "instance";
+ private final String instance = "instance";
private final ModuleIdentifier mi = new ModuleIdentifier("module", instance);
- private String instance2 = "instance2";
+ private final String instance2 = "instance2";
private final ModuleIdentifier mi2 = new ModuleIdentifier("module", instance2);
private final String message = "ex message";
private final Exception e = new IllegalStateException(message);
package org.opendaylight.controller.config.api.jmx;
+import java.util.ArrayList;
+import java.util.List;
+import javax.management.ObjectName;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
-import javax.management.ObjectName;
-import java.util.ArrayList;
-import java.util.List;
-
public class CommitStatusTest {
- List newInst = new ArrayList<ObjectName>();
- List reusedInst = new ArrayList<ObjectName>();
- List recreatedInst = new ArrayList<ObjectName>();
+ List<ObjectName> newInst = new ArrayList<>();
+ List<ObjectName> reusedInst = new ArrayList<>();
+ List<ObjectName> recreatedInst = new ArrayList<>();
@Before
public void setUp() throws Exception {
@Test
public void testNotEqual() throws Exception {
- List newInst2 = new ArrayList<ObjectName>();
- List reusedInst2 = new ArrayList<ObjectName>();
- List recreatedInst2 = new ArrayList<ObjectName>();
+ List<ObjectName> newInst2 = new ArrayList<>();
+ List<ObjectName> reusedInst2 = new ArrayList<>();
+ List<ObjectName> recreatedInst2 = new ArrayList<>();
newInst2.add(new ObjectName("first: key1 = value1"));
reusedInst2.add(new ObjectName("second: key = val"));
*/
package org.opendaylight.controller.config.api.jmx;
-import static junit.framework.Assert.fail;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
-
+import static org.junit.Assert.fail;
import com.google.common.base.Throwables;
import com.google.common.collect.Maps;
-
import java.util.HashMap;
import java.util.Map;
import javax.management.ObjectName;
-import junit.framework.Assert;
import org.junit.Before;
import org.junit.Test;
import org.opendaylight.controller.config.api.ModuleIdentifier;
assertPattern(on, pattern);
}
- private void assertPattern(ObjectName test, ObjectName pattern) {
+ private void assertPattern(final ObjectName test, final ObjectName pattern) {
assertTrue(pattern.isPattern());
assertTrue(pattern.apply(test));
}
}, IllegalArgumentException.class);
}
- private void assertFailure(Runnable test, Class<? extends Exception> ex) {
+ private void assertFailure(final Runnable test, final Class<? extends Exception> ex) {
try {
test.run();
} catch(Exception e) {
- Assert.assertTrue("Failed with wrong exception: " + Throwables.getStackTraceAsString(e),
+ assertTrue("Failed with wrong exception: " + Throwables.getStackTraceAsString(e),
e.getClass().isAssignableFrom(ex));
return;
}