import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
import org.junit.Test;
import org.opendaylight.protocol.util.ByteArray;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Address;
assertEquals("Cannot parse NEXT_HOP attribute. Wrong bytes length: 3", e.getMessage());
}
}
+
+ @Test(expected=UnsupportedOperationException.class)
+ public void testPrivateConstructor() throws Throwable {
+ final Constructor<NextHopUtil> c = NextHopUtil.class.getDeclaredConstructor();
+ c.setAccessible(true);
+ try {
+ c.newInstance();
+ } catch (InvocationTargetException e) {
+ throw e.getCause();
+ }
+ }
}
--- /dev/null
+/*
+ * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.protocol.bgp.linkstate;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import org.junit.Test;
+
+public class TlvCodeTest {
+
+ @Test(expected=UnsupportedOperationException.class)
+ public void testPrivateConstructor() throws Throwable {
+ final Constructor<TlvCode> c = TlvCode.class.getDeclaredConstructor();
+ c.setAccessible(true);
+ try {
+ c.newInstance();
+ } catch (InvocationTargetException e) {
+ throw e.getCause();
+ }
+ }
+
+}
import static org.junit.Assert.assertEquals;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.List;
-
import org.junit.Test;
import org.opendaylight.protocol.util.ByteArray;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.AsNumber;
final Open open2 = new OpenBuilder().setMyAsNumber(10).build();
assertEquals(10, AsNumberUtil.advertizedAsNumber(open2).getValue().intValue());
}
+
+ @Test(expected=UnsupportedOperationException.class)
+ public void testAsNumberUtilPrivateConstructor() throws Throwable {
+ final Constructor<AsNumberUtil> c = AsNumberUtil.class.getDeclaredConstructor();
+ c.setAccessible(true);
+ try {
+ c.newInstance();
+ } catch (InvocationTargetException e) {
+ throw e.getCause();
+ }
+ }
}
import static org.junit.Assert.assertArrayEquals;
import com.google.common.primitives.UnsignedBytes;
-
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
-
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
import java.util.Arrays;
-
import org.junit.Test;
import org.opendaylight.protocol.util.ByteArray;
AttributeUtil.formatAttribute(AttributeUtil.TRANSITIVE , 3 , Unpooled.wrappedBuffer(value), aggregator);
assertArrayEquals(result, ByteArray.getAllBytes(aggregator));
}
+
+ @Test(expected=UnsupportedOperationException.class)
+ public void testAttributeUtilPrivateConstructor() throws Throwable {
+ final Constructor<AttributeUtil> c = AttributeUtil.class.getDeclaredConstructor();
+ c.setAccessible(true);
+ try {
+ c.newInstance();
+ } catch (InvocationTargetException e) {
+ throw e.getCause();
+ }
+ }
+
+ @Test(expected=UnsupportedOperationException.class)
+ public void testCapabilityUtilPrivateConstructor() throws Throwable {
+ final Constructor<CapabilityUtil> c = CapabilityUtil.class.getDeclaredConstructor();
+ c.setAccessible(true);
+ try {
+ c.newInstance();
+ } catch (InvocationTargetException e) {
+ throw e.getCause();
+ }
+ }
+
+ @Test(expected=UnsupportedOperationException.class)
+ public void testMessageUtilPrivateConstructor() throws Throwable {
+ final Constructor<MessageUtil> c = MessageUtil.class.getDeclaredConstructor();
+ c.setAccessible(true);
+ try {
+ c.newInstance();
+ } catch (InvocationTargetException e) {
+ throw e.getCause();
+ }
+ }
+
+ @Test(expected=UnsupportedOperationException.class)
+ public void testParameterUtilPrivateConstructor() throws Throwable {
+ final Constructor<ParameterUtil> c = ParameterUtil.class.getDeclaredConstructor();
+ c.setAccessible(true);
+ try {
+ c.newInstance();
+ } catch (InvocationTargetException e) {
+ throw e.getCause();
+ }
+ }
}
--- /dev/null
+/*
+ * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.protocol.bgp.parser.spi.pojo;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import org.junit.Test;
+
+public class ServiceLoaderBGPExtensionProviderContextTest {
+
+ @Test(expected=UnsupportedOperationException.class)
+ public void testPrivateConstructor() throws Throwable {
+ final Constructor<ServiceLoaderBGPExtensionProviderContext> c = ServiceLoaderBGPExtensionProviderContext.class.getDeclaredConstructor();
+ c.setAccessible(true);
+ try {
+ c.newInstance();
+ } catch (InvocationTargetException e) {
+ throw e.getCause();
+ }
+ }
+}
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
import java.util.List;
-
import org.junit.Test;
public class BGPBinaryFileParserTest {
assertEquals(42, parsedMessages.size());
}
+ @Test(expected=UnsupportedOperationException.class)
+ public void testPrivateConstructor() throws Throwable {
+ final Constructor<BinaryBGPDumpFileParser> c = BinaryBGPDumpFileParser.class.getDeclaredConstructor();
+ c.setAccessible(true);
+ try {
+ c.newInstance();
+ } catch (InvocationTargetException e) {
+ throw e.getCause();
+ }
+ }
+
}
import java.io.File;
import java.io.FileNotFoundException;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
import java.util.List;
import org.junit.Test;
}
}
+ @Test(expected=UnsupportedOperationException.class)
+ public void testPrivateConstructor() throws Throwable {
+ final Constructor<HexDumpBGPFileParser> c = HexDumpBGPFileParser.class.getDeclaredConstructor();
+ c.setAccessible(true);
+ try {
+ c.newInstance();
+ } catch (InvocationTargetException e) {
+ throw e.getCause();
+ }
+ }
+
}
--- /dev/null
+/*
+ * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.protocol.pcep.impl;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.protocol.pcep.spi.PCEPErrors;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev131007.Pcerr;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Message;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.open.object.Open;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.open.object.OpenBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcep.error.object.ErrorObject;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcerr.message.pcerr.message.error.type.SessionCase;
+
+public class UtilTest {
+
+ private static final Open OPEN = new OpenBuilder().build();
+
+ @Test
+ public void testCreateErrorMessageWithOpen() {
+ final Message msg = Util.createErrorMessage(PCEPErrors.BAD_LABEL_VALUE, OPEN);
+ Assert.assertTrue(msg instanceof Pcerr);
+ final Pcerr errMsg = (Pcerr) msg;
+ Assert.assertTrue(errMsg.getPcerrMessage().getErrorType() instanceof SessionCase);
+ final SessionCase sessionCase = (SessionCase) errMsg.getPcerrMessage().getErrorType();
+ Assert.assertEquals(OPEN, sessionCase.getSession().getOpen());
+ final ErrorObject errorObject = errMsg.getPcerrMessage().getErrors().get(0).getErrorObject();
+ Assert.assertEquals(PCEPErrors.BAD_LABEL_VALUE.getErrorType(), errorObject.getType().shortValue());
+ Assert.assertEquals(PCEPErrors.BAD_LABEL_VALUE.getErrorValue(), errorObject.getValue().shortValue());
+ }
+
+ @Test
+ public void testCreateErrorMessage() {
+ final Message msg = Util.createErrorMessage(PCEPErrors.BAD_LABEL_VALUE, null);
+ Assert.assertTrue(msg instanceof Pcerr);
+ final Pcerr errMsg = (Pcerr) msg;
+ Assert.assertNull(errMsg.getPcerrMessage().getErrorType());
+ final ErrorObject errorObject = errMsg.getPcerrMessage().getErrors().get(0).getErrorObject();
+ Assert.assertEquals(PCEPErrors.BAD_LABEL_VALUE.getErrorType(), errorObject.getType().shortValue());
+ Assert.assertEquals(PCEPErrors.BAD_LABEL_VALUE.getErrorValue(), errorObject.getValue().shortValue());
+ }
+
+ @Test(expected=UnsupportedOperationException.class)
+ public void testPrivateConstructor() throws Throwable {
+ final Constructor<Util> c = Util.class.getDeclaredConstructor();
+ c.setAccessible(true);
+ try {
+ c.newInstance();
+ } catch (InvocationTargetException e) {
+ throw e.getCause();
+ }
+ }
+
+}
+/*
+ * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
package org.opendaylight.protocol.pcep.pcc.mock;
import io.netty.buffer.Unpooled;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
import junit.framework.Assert;
import org.junit.Test;
import org.opendaylight.protocol.pcep.spi.ObjectHeaderImpl;
Assert.assertEquals(srp, parser.parseObject(new ObjectHeaderImpl(true, true), Unpooled.wrappedBuffer(bytes)));
}
+ @Test(expected=UnsupportedOperationException.class)
+ public void testPrivateConstructor() throws Throwable {
+ final Constructor<MsgBuilderUtil> c = MsgBuilderUtil.class.getDeclaredConstructor();
+ c.setAccessible(true);
+ try {
+ c.newInstance();
+ } catch (InvocationTargetException e) {
+ throw e.getCause();
+ }
+ }
+
}
}
protected static Srp addSRPathSetupTypeTlv(final Srp srp) {
- return new SrpBuilder(srp).setTlvs(new TlvsBuilder(srp.getTlvs()).addAugmentation(Tlvs5.class,
+ return new SrpBuilder(srp).setTlvs(new TlvsBuilder(srp.getTlvs() != null ? srp.getTlvs() : new TlvsBuilder().build()).addAugmentation(Tlvs5.class,
new Tlvs5Builder().setPathSetupType(new PathSetupTypeBuilder().setPst(true).build()).build()).build()).build();
}
--- /dev/null
+/*
+ * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.protocol.pcep.segment.routing02;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import junit.framework.Assert;
+import org.junit.Test;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.srp.object.Srp;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.srp.object.SrpBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.lsp.setup.type._01.rev140507.Tlvs5;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.lsp.setup.type._01.rev140507.Tlvs5Builder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.lsp.setup.type._01.rev140507.path.setup.type.tlv.PathSetupTypeBuilder;
+
+public class SrEroUtilTest {
+
+ @Test(expected=UnsupportedOperationException.class)
+ public void testPrivateConstructor() throws Throwable {
+ final Constructor<SrEroUtil> c = SrEroUtil.class.getDeclaredConstructor();
+ c.setAccessible(true);
+ try {
+ c.newInstance();
+ } catch (InvocationTargetException e) {
+ throw e.getCause();
+ }
+ }
+
+ @Test
+ public void testAddSRPathSetupTypeTlv() {
+ final SrpBuilder srpBuilder = new SrpBuilder();
+ final Srp srp = SrEroUtil.addSRPathSetupTypeTlv(srpBuilder.build());
+ Assert.assertTrue(srp.getTlvs().getAugmentation(Tlvs5.class).getPathSetupType().isPst());
+ }
+
+ @Test
+ public void testIsPst() {
+ Assert.assertTrue(SrEroUtil.isPst(new Tlvs5Builder().setPathSetupType(new PathSetupTypeBuilder().setPst(true).build()).build()));
+ Assert.assertFalse(SrEroUtil.isPst(new Tlvs5Builder().setPathSetupType(new PathSetupTypeBuilder().setPst(false).build()).build()));
+ Assert.assertFalse(SrEroUtil.isPst(null));
+ Assert.assertFalse(SrEroUtil.isPst(new Tlvs5Builder().build()));
+ }
+}
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
import org.junit.Test;
import org.opendaylight.protocol.util.ByteArray;
assertFalse(VendorInformationUtil.isVendorInformationObject(VendorInformationUtil.VENDOR_INFORMATION_TLV_TYPE, VendorInformationUtil.VENDOR_INFORMATION_OBJECT_TYPE));
assertFalse(VendorInformationUtil.isVendorInformationObject(VendorInformationUtil.VENDOR_INFORMATION_OBJECT_TYPE, VendorInformationUtil.VENDOR_INFORMATION_OBJECT_CLASS));
}
+
+ @Test(expected=UnsupportedOperationException.class)
+ public void testVendorInformationUtilPrivateConstructor() throws Throwable {
+ final Constructor<VendorInformationUtil> c = VendorInformationUtil.class.getDeclaredConstructor();
+ c.setAccessible(true);
+ try {
+ c.newInstance();
+ } catch (InvocationTargetException e) {
+ throw e.getCause();
+ }
+ }
+
+ @Test(expected=UnsupportedOperationException.class)
+ public void testEROSubobjectUtilPrivateConstructor() throws Throwable {
+ final Constructor<EROSubobjectUtil> c = EROSubobjectUtil.class.getDeclaredConstructor();
+ c.setAccessible(true);
+ try {
+ c.newInstance();
+ } catch (InvocationTargetException e) {
+ throw e.getCause();
+ }
+ }
+
+ @Test(expected=UnsupportedOperationException.class)
+ public void testRROSubobjectUtilPrivateConstructor() throws Throwable {
+ final Constructor<RROSubobjectUtil> c = RROSubobjectUtil.class.getDeclaredConstructor();
+ c.setAccessible(true);
+ try {
+ c.newInstance();
+ } catch (InvocationTargetException e) {
+ throw e.getCause();
+ }
+ }
+
+ @Test(expected=UnsupportedOperationException.class)
+ public void testTlvUtilPrivateConstructor() throws Throwable {
+ final Constructor<TlvUtil> c = TlvUtil.class.getDeclaredConstructor();
+ c.setAccessible(true);
+ try {
+ c.newInstance();
+ } catch (InvocationTargetException e) {
+ throw e.getCause();
+ }
+ }
+
+ @Test(expected=UnsupportedOperationException.class)
+ public void testXROSubobjectUtilPrivateConstructor() throws Throwable {
+ final Constructor<XROSubobjectUtil> c = XROSubobjectUtil.class.getDeclaredConstructor();
+ c.setAccessible(true);
+ try {
+ c.newInstance();
+ } catch (InvocationTargetException e) {
+ throw e.getCause();
+ }
+ }
+
+ @Test(expected=UnsupportedOperationException.class)
+ public void testObjectUtilPrivateConstructor() throws Throwable {
+ final Constructor<ObjectUtil> c = ObjectUtil.class.getDeclaredConstructor();
+ c.setAccessible(true);
+ try {
+ c.newInstance();
+ } catch (InvocationTargetException e) {
+ throw e.getCause();
+ }
+ }
+
+ @Test(expected=UnsupportedOperationException.class)
+ public void testMessageUtilPrivateConstructor() throws Throwable {
+ final Constructor<MessageUtil> c = MessageUtil.class.getDeclaredConstructor();
+ c.setAccessible(true);
+ try {
+ c.newInstance();
+ } catch (InvocationTargetException e) {
+ throw e.getCause();
+ }
+ }
+
+ @Test(expected=UnsupportedOperationException.class)
+ public void testLabelUtilPrivateConstructor() throws Throwable {
+ final Constructor<LabelUtil> c = LabelUtil.class.getDeclaredConstructor();
+ c.setAccessible(true);
+ try {
+ c.newInstance();
+ } catch (InvocationTargetException e) {
+ throw e.getCause();
+ }
+ }
+
+ @Test(expected=UnsupportedOperationException.class)
+ public void testPCEPMessageConstantsPrivateConstructor() throws Throwable {
+ final Constructor<PCEPMessageConstants> c = PCEPMessageConstants.class.getDeclaredConstructor();
+ c.setAccessible(true);
+ try {
+ c.newInstance();
+ } catch (InvocationTargetException e) {
+ throw e.getCause();
+ }
+ }
}
import static org.junit.Assert.assertTrue;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
import java.math.BigInteger;
-
import org.junit.Test;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.programming.rev130930.Nanotime;
import org.slf4j.Logger;
LOG.debug("Times: {} {}", nt1, nt2);
assertTrue(nt1.getValue().compareTo(nt2.getValue()) < 0);
}
+
+ @Test(expected=UnsupportedOperationException.class)
+ public void testPrivateConstructor() throws Throwable {
+ final Constructor<NanotimeUtil> c = NanotimeUtil.class.getDeclaredConstructor();
+ c.setAccessible(true);
+ try {
+ c.newInstance();
+ } catch (InvocationTargetException e) {
+ throw e.getCause();
+ }
+ }
}
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotSame;
import static org.junit.Assert.assertTrue;
+
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
-
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
import java.util.Arrays;
import java.util.BitSet;
-
import org.junit.Before;
import org.junit.Test;
assertArrayEquals(new byte[] { (byte) 0xAC, (byte) 0x80, 0, 0 }, ByteArray.maskBytes(bytes, 10));
}
+ @Test(expected=UnsupportedOperationException.class)
+ public void testPrivateConstructor() throws Throwable {
+ final Constructor<ByteArray> c = ByteArray.class.getDeclaredConstructor();
+ c.setAccessible(true);
+ try {
+ c.newInstance();
+ } catch (InvocationTargetException e) {
+ throw e.getCause();
+ }
+ }
+
}
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
import java.math.BigInteger;
import java.util.BitSet;
import org.junit.Test;
writeBitSet(null, 1, output);
assertArrayEquals(ONE_BYTE_ZERO, output.array());
}
+
+ @Test(expected=UnsupportedOperationException.class)
+ public void testPrivateConstructor() throws Throwable {
+ final Constructor<ByteBufWriteUtil> c = ByteBufWriteUtil.class.getDeclaredConstructor();
+ c.setAccessible(true);
+ try {
+ c.newInstance();
+ } catch (InvocationTargetException e) {
+ throw e.getCause();
+ }
+ }
}
import com.google.common.collect.Lists;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
import java.net.UnknownHostException;
import java.util.List;
import org.junit.Test;
final List<Ipv6Prefix> prefs = Ipv6Util.prefixListForBytes(bytes);
assertEquals(prefs, Lists.newArrayList(new Ipv6Prefix("2001:db8:1:2::/64"), new Ipv6Prefix("2001:db8:1:1::/64")));
}
+
+ @Test(expected=UnsupportedOperationException.class)
+ public void testIpv4UtilPrivateConstructor() throws Throwable {
+ final Constructor<Ipv4Util> c = Ipv4Util.class.getDeclaredConstructor();
+ c.setAccessible(true);
+ try {
+ c.newInstance();
+ } catch (InvocationTargetException e) {
+ throw e.getCause();
+ }
+ }
+
+ @Test(expected=UnsupportedOperationException.class)
+ public void testIpv6UtilPrivateConstructor() throws Throwable {
+ final Constructor<Ipv6Util> c = Ipv6Util.class.getDeclaredConstructor();
+ c.setAccessible(true);
+ try {
+ c.newInstance();
+ } catch (InvocationTargetException e) {
+ throw e.getCause();
+ }
+ }
}
--- /dev/null
+/*
+ * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.protocol.util;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class NoopReferenceCacheTest {
+
+ private static final Object OBJ = new Object();
+
+ @Test
+ public void testSharedReference() {
+ Assert.assertEquals(OBJ, NoopReferenceCache.getInstance().getSharedReference(OBJ));
+ }
+}
import java.io.File;
import java.io.FileNotFoundException;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
import java.util.List;
import org.junit.Test;
public void testParsing() throws Exception {
final List<byte[]> result = PCEPHexDumpParser.parseMessages(getClass().getClassLoader().getResourceAsStream(
PCEPHexDumpParserTest.hexDumpFileName));
- assertEquals(this.expectedSize, result.size());
+ assertEquals(expectedSize, result.size());
final List<byte[]> result1 = PCEPHexDumpParser.parseMessages(new File(getClass().getClassLoader().getResource(
PCEPHexDumpParserTest.hexDumpFileName).toURI()));
- assertEquals(this.expectedSize, result1.size());
+ assertEquals(expectedSize, result1.size());
}
@Test
assertThat(e.getMessage(), containsString("bad file name"));
}
}
+
+ @Test(expected=UnsupportedOperationException.class)
+ public void testPrivateConstructor() throws Throwable {
+ final Constructor<PCEPHexDumpParser> c = PCEPHexDumpParser.class.getDeclaredConstructor();
+ c.setAccessible(true);
+ try {
+ c.newInstance();
+ } catch (InvocationTargetException e) {
+ throw e.getCause();
+ }
+ }
}
--- /dev/null
+/*
+ * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.protocol.util;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import org.junit.Test;
+
+public class ValuesTest {
+
+ @Test(expected=UnsupportedOperationException.class)
+ public void testPrivateConstructor() throws Throwable {
+ final Constructor<Values> c = Values.class.getDeclaredConstructor();
+ c.setAccessible(true);
+ try {
+ c.newInstance();
+ } catch (InvocationTargetException e) {
+ throw e.getCause();
+ }
+ }
+}