List of usage examples for org.apache.commons.lang3 StringUtils contains
public static boolean contains(final CharSequence seq, final CharSequence searchSeq)
Checks if CharSequence contains a search CharSequence, handling null .
From source file:org.onlab.packet.IPv4Test.java
/** * Tests toString.//w ww.j a v a2 s.c om */ @Test public void testToStringIPv4() throws Exception { IPv4 ipv4 = deserializer.deserialize(headerBytes, 0, headerBytes.length); String str = ipv4.toString(); assertTrue(StringUtils.contains(str, "version=" + version)); assertTrue(StringUtils.contains(str, "headerLength=" + headerLength)); assertTrue(StringUtils.contains(str, "diffServ=" + diffServ)); assertTrue(StringUtils.contains(str, "totalLength=" + totalLength)); assertTrue(StringUtils.contains(str, "identification=" + identification)); assertTrue(StringUtils.contains(str, "flags=" + flags)); assertTrue(StringUtils.contains(str, "fragmentOffset=" + fragmentOffset)); assertTrue(StringUtils.contains(str, "ttl=" + ttl)); assertTrue(StringUtils.contains(str, "protocol=" + protocol)); assertTrue(StringUtils.contains(str, "checksum=" + checksum)); assertTrue(StringUtils.contains(str, "sourceAddress=" + sourceAddress)); assertTrue(StringUtils.contains(str, "destinationAddress=" + destinationAddress)); }
From source file:org.onlab.packet.ipv6.AuthenticationTest.java
/** * Tests toString.//from w w w.j a va 2 s . c om */ @Test public void testToStringAuthentication() throws Exception { Authentication auth = deserializer.deserialize(bytePacket, 0, bytePacket.length); String str = auth.toString(); assertTrue(StringUtils.contains(str, "nextHeader=" + (byte) 0x11)); assertTrue(StringUtils.contains(str, "payloadLength=" + (byte) 0x02)); assertTrue(StringUtils.contains(str, "securityParamIndex=" + 0x13572468)); assertTrue(StringUtils.contains(str, "sequence=" + 0xffff00)); assertTrue(StringUtils.contains(str, "integrityCheck=" + Arrays.toString(icv))); }
From source file:org.onlab.packet.ipv6.BaseOptionsTest.java
/** * Tests toString.// w w w.ja va 2 s .c o m */ @Test public void testToStringBaseOptions() throws Exception { BaseOptions baseopt = deserializer.deserialize(bytePacket, 0, bytePacket.length); String str = baseopt.toString(); assertTrue(StringUtils.contains(str, "nextHeader=" + (byte) 0x11)); assertTrue(StringUtils.contains(str, "headerExtLength=" + (byte) 0x00)); assertTrue(StringUtils.contains(str, "options=" + Arrays.toString(options))); }
From source file:org.onlab.packet.ipv6.EncapSecurityPayloadTest.java
/** * Tests toString./*from w w w.j av a 2 s . com*/ */ @Test public void testToStringESP() throws Exception { EncapSecurityPayload esp = deserializer.deserialize(bytePacket, 0, bytePacket.length); String str = esp.toString(); assertTrue(StringUtils.contains(str, "securityParamIndex=" + 0x13572468)); assertTrue(StringUtils.contains(str, "sequence=" + 0xffff00)); }
From source file:org.onlab.packet.ipv6.FragmentTest.java
/** * Tests toString.//from ww w . j a va 2s. co m */ @Test public void testToStringFragment() throws Exception { Fragment frag = deserializer.deserialize(bytePacket, 0, bytePacket.length); String str = frag.toString(); assertTrue(StringUtils.contains(str, "nextHeader=" + (byte) 0x11)); assertTrue(StringUtils.contains(str, "fragmentOffset=" + (short) 0x1f)); assertTrue(StringUtils.contains(str, "moreFragment=" + (byte) 1)); assertTrue(StringUtils.contains(str, "identification=" + 0x1357)); }
From source file:org.onlab.packet.ipv6.RoutingTest.java
/** * Tests toString./* w ww. ja v a 2 s. c om*/ */ @Test public void testToStringRouting() throws Exception { Routing routing = deserializer.deserialize(bytePacket, 0, bytePacket.length); String str = routing.toString(); assertTrue(StringUtils.contains(str, "nextHeader=" + (byte) 0x11)); assertTrue(StringUtils.contains(str, "headerExtLength=" + (byte) 0x02)); assertTrue(StringUtils.contains(str, "routingType=" + (byte) 0x00)); assertTrue(StringUtils.contains(str, "segmentsLeft=" + (byte) 0x03)); assertTrue(StringUtils.contains(str, "routingData=" + Arrays.toString(routingData))); }
From source file:org.onlab.packet.IPv6Test.java
/** * Tests toString.//from ww w . ja v a 2 s . c o m */ @Test public void testToStringIPv6() throws Exception { IPv6 ipv6 = deserializer.deserialize(bytePacket, 0, bytePacket.length); String str = ipv6.toString(); assertTrue(StringUtils.contains(str, "version=" + (byte) 6)); assertTrue(StringUtils.contains(str, "trafficClass=" + (byte) 0x93)); assertTrue(StringUtils.contains(str, "flowLabel=" + 0x13579)); assertTrue(StringUtils.contains(str, "nextHeader=" + IPv6.PROTOCOL_UDP)); assertTrue(StringUtils.contains(str, "hopLimit=" + (byte) 32)); // TODO: test IPv6 source and destination address }
From source file:org.onlab.packet.LLCTest.java
/** * Tests toString.// ww w . j ava 2s . c o m */ @Test public void testToStringLLC() throws Exception { LLC llc = deserializer.deserialize(bytes, 0, bytes.length); String str = llc.toString(); assertTrue(StringUtils.contains(str, "dsap=" + dsap)); assertTrue(StringUtils.contains(str, "ssap=" + ssap)); assertTrue(StringUtils.contains(str, "ctrl=" + ctrl)); }
From source file:org.onlab.packet.MplsTest.java
/** * Tests toString.//from www.j a v a2 s .c o m */ @Test public void testToStringMpls() throws Exception { MPLS mpls = deserializer.deserialize(bytes, 0, bytes.length); String str = mpls.toString(); assertTrue(StringUtils.contains(str, "label=" + label)); assertTrue(StringUtils.contains(str, "bos=" + bos)); assertTrue(StringUtils.contains(str, "ttl=" + ttl)); assertTrue(StringUtils.contains(str, "protocol=" + protocol)); }
From source file:org.onlab.packet.ndp.NeighborAdvertisementTest.java
/** * Tests toString.//w ww . j a va2 s .c o m */ @Test public void testToStringNA() throws Exception { NeighborAdvertisement na = deserializer.deserialize(bytePacket, 0, bytePacket.length); String str = na.toString(); assertTrue(StringUtils.contains(str, "routerFlag=" + (byte) 1)); assertTrue(StringUtils.contains(str, "solicitedFlag=" + (byte) 1)); assertTrue(StringUtils.contains(str, "overrideFlag=" + (byte) 1)); // TODO: need to handle TARGET_ADDRESS }