com.google.common.testing.EqualsTester Java Examples

The following examples show how to use com.google.common.testing.EqualsTester. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: OchSignalTest.java    From onos with Apache License 2.0 6 votes vote down vote up
@Test
public void testEquality() {
    OchSignal och1 = newDwdmSlot(ChannelSpacing.CHL_100GHZ, 1);
    OchSignal sameOch1 = newDwdmSlot(ChannelSpacing.CHL_100GHZ, 1);
    OchSignal och2 = new OchSignal(GridType.CWDM, ChannelSpacing.CHL_100GHZ, 4, 8);
    OchSignal sameOch2 = new OchSignal(GridType.CWDM, ChannelSpacing.CHL_100GHZ, 4, 8);
    OchSignal och3 = newDwdmSlot(ChannelSpacing.CHL_100GHZ, 3);
    OchSignal sameOch3 = newDwdmSlot(ChannelSpacing.CHL_100GHZ, 3);
    OchSignal och4 = newFlexGridSlot(3);
    OchSignal sameOch4 = newFlexGridSlot(3);

    new EqualsTester()
            .addEqualityGroup(och1, sameOch1)
            .addEqualityGroup(och2, sameOch2)
            .addEqualityGroup(och3, sameOch3)
            .addEqualityGroup(och4, sameOch4)
            .testEquals();
}
 
Example #2
Source File: Layer3EdgeTest.java    From batfish with Apache License 2.0 6 votes vote down vote up
@Test
public void testEquals() {
  new EqualsTester()
      .addEqualityGroup(
          new Layer3Edge(
              NodeInterfacePair.of("node1", "interface1"),
              NodeInterfacePair.of("node2", "interface2"),
              ImmutableSortedSet.of(ConcreteInterfaceAddress.create(Ip.parse("1.1.1.1"), 32)),
              ImmutableSortedSet.of(ConcreteInterfaceAddress.create(Ip.parse("2.2.2.2"), 32))),
          new Layer3Edge(
              NodeInterfacePair.of("node1", "interface1"),
              NodeInterfacePair.of("node2", "interface2"),
              ImmutableSortedSet.of(ConcreteInterfaceAddress.create(Ip.parse("1.1.1.1"), 32)),
              ImmutableSortedSet.of(ConcreteInterfaceAddress.create(Ip.parse("2.2.2.2"), 32))))
      .addEqualityGroup(
          new Layer3Edge(
              NodeInterfacePair.of("diffnode1", "diffinterface1"),
              NodeInterfacePair.of("diffnode2", "diffinterface2"),
              ImmutableSortedSet.of(ConcreteInterfaceAddress.create(Ip.parse("3.3.3.3"), 32)),
              ImmutableSortedSet.of(ConcreteInterfaceAddress.create(Ip.parse("4.4.4.4"), 32))))
      .testEquals();
}
 
Example #3
Source File: IpAddressTest.java    From onos with Apache License 2.0 6 votes vote down vote up
/**
 * Tests equality of {@link IpAddress} for IPv6.
 */
@Test
public void testEqualityIPv6() {
    new EqualsTester()
        .addEqualityGroup(
            IpAddress.valueOf("1111:2222:3333:4444:5555:6666:7777:8888"),
            IpAddress.valueOf("1111:2222:3333:4444:5555:6666:7777:8888"))
        .addEqualityGroup(
            IpAddress.valueOf("1111:2222:3333:4444:5555:6666:7777:888a"),
            IpAddress.valueOf("1111:2222:3333:4444:5555:6666:7777:888a"))
        .addEqualityGroup(
            IpAddress.valueOf("::"),
            IpAddress.valueOf("::"))
        .addEqualityGroup(
            IpAddress.valueOf("ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff"),
            IpAddress.valueOf("ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff"))
        .testEquals();
}
 
Example #4
Source File: EigrpNeighborConfigTest.java    From batfish with Apache License 2.0 6 votes vote down vote up
@Test
public void testEquals() {
  Builder builder =
      EigrpNeighborConfig.builder()
          .setAsn(2L)
          .setExportPolicy("policy")
          .setHostname("host")
          .setVrfName("vrf")
          .setInterfaceName("Ethernet0")
          .setIp(Ip.parse("1.1.1.1"));
  new EqualsTester()
      .addEqualityGroup(builder.build(), builder.build())
      .addEqualityGroup(builder.setAsn(1L).build())
      .addEqualityGroup(builder.setExportPolicy("policy_new").build())
      .addEqualityGroup(builder.setInterfaceName("Ethernet11").build())
      .addEqualityGroup(builder.setIp(Ip.parse("2.2.2.2")))
      .addEqualityGroup(builder.setPassive(true).build())
      .addEqualityGroup(builder.setHostname("otherHost").build())
      .addEqualityGroup(builder.setVrfName("otherVRF").build())
      .addEqualityGroup(new Object())
      .testEquals();
}
 
Example #5
Source File: BgpFsDestinationPortNumTest.java    From onos with Apache License 2.0 6 votes vote down vote up
@Test
public void testEquality() {
    operatorValue1.add(new BgpFsOperatorValue((byte) 1, new byte[100]));
    operatorValue1.add(new BgpFsOperatorValue((byte) 1, new byte[100]));
    operatorValue2.add(new BgpFsOperatorValue((byte) 2, new byte[100]));
    operatorValue2.add(new BgpFsOperatorValue((byte) 1, new byte[100]));

    BgpFsDestinationPortNum tlv1 = new BgpFsDestinationPortNum(operatorValue1);
    BgpFsDestinationPortNum sameAsTlv1 = new BgpFsDestinationPortNum(operatorValue1);
    BgpFsDestinationPortNum tlv2 = new BgpFsDestinationPortNum(operatorValue2);

    new EqualsTester()
    .addEqualityGroup(tlv1, sameAsTlv1)
    .addEqualityGroup(tlv2)
    .testEquals();
}
 
Example #6
Source File: TableEntryEncoderTest.java    From onos with Apache License 2.0 6 votes vote down vote up
@Test
public void testActopProfileGroup() throws Exception {
    TableEntry tableEntryMsg = Codecs.CODECS.tableEntry().encode(
            piTableEntryWithGroupAction, null, defaultPipeconf);
    PiTableEntry decodedPiTableEntry = Codecs.CODECS.tableEntry().decode(
            tableEntryMsg, null, defaultPipeconf);

    // Test equality for decoded entry.
    new EqualsTester()
            .addEqualityGroup(piTableEntryWithGroupAction, decodedPiTableEntry)
            .testEquals();

    // Table ID.
    int p4InfoTableId = browser.tables().getByName(ecmpTableId.id()).getPreamble().getId();
    int encodedTableId = tableEntryMsg.getTableId();
    assertThat(encodedTableId, is(p4InfoTableId));

    // Exact match.
    byte[] encodedTernaryMatchValue = tableEntryMsg.getMatch(0).getExact().getValue().toByteArray();
    assertThat(encodedTernaryMatchValue, is(new byte[]{(byte) 0xff}));

    // Action profile group id
    int actionProfileGroupId = tableEntryMsg.getAction().getActionProfileGroupId();
    assertThat(actionProfileGroupId, is(1));
}
 
Example #7
Source File: ModifiedFileSetTest.java    From bazel with Apache License 2.0 6 votes vote down vote up
@Test
public void testHashCodeAndEqualsContract() throws Exception {
  PathFragment fragA = PathFragment.create("a");
  PathFragment fragB = PathFragment.create("b");

  ModifiedFileSet empty1 = ModifiedFileSet.NOTHING_MODIFIED;
  ModifiedFileSet empty2 = ModifiedFileSet.builder().build();
  ModifiedFileSet empty3 = ModifiedFileSet.builder().modifyAll(
      ImmutableList.<PathFragment>of()).build();

  ModifiedFileSet nonEmpty1 = ModifiedFileSet.builder().modifyAll(
      ImmutableList.of(fragA, fragB)).build();
  ModifiedFileSet nonEmpty2 = ModifiedFileSet.builder().modifyAll(
      ImmutableList.of(fragB, fragA)).build();
  ModifiedFileSet nonEmpty3 = ModifiedFileSet.builder().modify(fragA).modify(fragB).build();
  ModifiedFileSet nonEmpty4 = ModifiedFileSet.builder().modify(fragB).modify(fragA).build();

  ModifiedFileSet everythingModified = ModifiedFileSet.EVERYTHING_MODIFIED;

  new EqualsTester()
      .addEqualityGroup(empty1, empty2, empty3)
      .addEqualityGroup(nonEmpty1, nonEmpty2, nonEmpty3, nonEmpty4)
      .addEqualityGroup(everythingModified)
      .testEquals();
}
 
Example #8
Source File: UIfTest.java    From Refaster with Apache License 2.0 6 votes vote down vote up
@Test
public void equality() {
  new EqualsTester()
      .addEqualityGroup(UIf.create(
          UFreeIdent.create("cond"), 
          UBlock.create(UExpressionStatement.create(
              UAssign.create(UFreeIdent.create("x"), UFreeIdent.create("y")))), 
          UBlock.create(UExpressionStatement.create(
              UAssign.create(UFreeIdent.create("x"), UFreeIdent.create("z"))))))
      .addEqualityGroup(UIf.create(
          UFreeIdent.create("cond"), 
          UBlock.create(UExpressionStatement.create(
              UAssign.create(UFreeIdent.create("x"), UFreeIdent.create("y")))),
          null))
      .addEqualityGroup(UIf.create(
          ULiteral.booleanLit(true), 
          UBlock.create(UExpressionStatement.create(
              UAssign.create(UFreeIdent.create("x"), UFreeIdent.create("y")))),
          UBlock.create(UExpressionStatement.create(
              UAssign.create(UFreeIdent.create("x"), UFreeIdent.create("z"))))))
      .testEquals();
}
 
Example #9
Source File: PCollectionListTest.java    From beam with Apache License 2.0 6 votes vote down vote up
@Test
public void testEquals() {
  Pipeline p = TestPipeline.create();
  PCollection<String> first = p.apply("Meta", Create.of("foo", "bar"));
  PCollection<String> second = p.apply("Pythonic", Create.of("spam, ham"));
  PCollection<String> third = p.apply("Syntactic", Create.of("eggs", "baz"));

  EqualsTester tester = new EqualsTester();
  //    tester.addEqualityGroup(PCollectionList.empty(p), PCollectionList.empty(p));
  //    tester.addEqualityGroup(PCollectionList.of(first).and(second));
  // Constructors should all produce equivalent
  tester.addEqualityGroup(
      PCollectionList.of(first).and(second).and(third),
      PCollectionList.of(first).and(second).and(third),
      //        PCollectionList.<String>empty(p).and(first).and(second).and(third),
      //        PCollectionList.of(ImmutableList.of(first, second, third)),
      //        PCollectionList.of(first).and(ImmutableList.of(second, third)),
      PCollectionList.of(ImmutableList.of(first, second)).and(third));
  // Order is considered
  tester.addEqualityGroup(PCollectionList.of(first).and(third).and(second));
  tester.addEqualityGroup(PCollectionList.empty(TestPipeline.create()));

  tester.testEquals();
}
 
Example #10
Source File: UMethodInvocationTest.java    From Refaster with Apache License 2.0 6 votes vote down vote up
@Test
public void equality() {
  UMethodType indexOfIntTy = UMethodType.create(UPrimitiveType.INT, UPrimitiveType.INT);
  UExpression fooLit = ULiteral.stringLit("foo");
  UType isEmptyTy = UMethodType.create(UPrimitiveType.BOOLEAN, ImmutableList.<UType>of());
  
  new EqualsTester()
      .addEqualityGroup(
          UMethodInvocation.create(
              UMemberSelect.create(fooLit, "indexOf", indexOfIntTy), ULiteral.charLit('a')))
      .addEqualityGroup(
          UMethodInvocation.create(
              UMemberSelect.create(fooLit, "indexOf", indexOfIntTy), ULiteral.charLit('b')))
      .addEqualityGroup(
          UMethodInvocation.create(UMemberSelect.create(fooLit, "isEmpty", isEmptyTy)))
      .testEquals();
}
 
Example #11
Source File: OspfExternalType1RouteTest.java    From batfish with Apache License 2.0 6 votes vote down vote up
@Test
public void testEquals() {

  OspfExternalType2Route.Builder b =
      OspfExternalRoute.builder()
          .setNetwork(Ip.parse("1.1.1.1").toPrefix())
          .setNextHopIp(Ip.ZERO)
          .setAdmin(1)
          .setMetric(1)
          .setLsaMetric(1)
          .setArea(1)
          .setCostToAdvertiser(1)
          .setAdvertiser("")
          .setOspfMetricType(OspfMetricType.E1);

  OspfExternalRoute r1 = b.build();
  OspfExternalRoute r1DiffObj = b.build();
  OspfExternalRoute r2 = b.setCostToAdvertiser(2).build();
  OspfExternalRoute r2t2 = b.setOspfMetricType(OspfMetricType.E2).build();

  new EqualsTester()
      .addEqualityGroup(r1, r1DiffObj)
      .addEqualityGroup(r2)
      .addEqualityGroup(r2t2)
      .testEquals();
}
 
Example #12
Source File: StaticRouteTest.java    From batfish with Apache License 2.0 6 votes vote down vote up
@Test
public void testEquals() {
  StaticRoute.Builder b =
      StaticRoute.builder().setNetwork(Prefix.parse("1.1.1.0/24")).setAdministrativeCost(1);
  new EqualsTester()
      .addEqualityGroup(b.build(), b.build())
      .addEqualityGroup(b.setNetwork(Prefix.parse("2.2.2.0/24")).build())
      .addEqualityGroup(b.setAdministrativeCost(2).build())
      .addEqualityGroup(b.setNonRouting(true).build())
      .addEqualityGroup(b.setNonForwarding(true).build())
      .addEqualityGroup(b.setMetric(3).build())
      .addEqualityGroup(b.setNextHopIp(Ip.parse("2.2.2.2")).build())
      .addEqualityGroup(b.setNextHopInterface("Ethernet0").build())
      .addEqualityGroup(b.setNextVrf("otherVrf").build())
      .addEqualityGroup(b.setTag(4L).build())
      .addEqualityGroup(new Object())
      .testEquals();
}
 
Example #13
Source File: RouteFilterLineTest.java    From batfish with Apache License 2.0 6 votes vote down vote up
@Test
public void testEquals() {
  RouteFilterLine rfl =
      new RouteFilterLine(LineAction.PERMIT, IpWildcard.parse("1.1.1.1"), new SubRange(30, 32));
  new EqualsTester()
      .addEqualityGroup(
          rfl,
          rfl,
          new RouteFilterLine(
              LineAction.PERMIT, IpWildcard.parse("1.1.1.1"), new SubRange(30, 32)))
      .addEqualityGroup(
          new RouteFilterLine(LineAction.DENY, IpWildcard.parse("1.1.1.1"), new SubRange(30, 32)))
      .addEqualityGroup(
          new RouteFilterLine(
              LineAction.PERMIT, IpWildcard.parse("2.2.2.2"), new SubRange(30, 32)))
      .addEqualityGroup(
          new RouteFilterLine(
              LineAction.PERMIT, IpWildcard.parse("2.2.2.2"), new SubRange(29, 32)))
      .addEqualityGroup(new Object())
      .testEquals();
}
 
Example #14
Source File: TunnelSubscriptionTest.java    From onos with Apache License 2.0 6 votes vote down vote up
/**
 * Checks the operation of equals(), hashCode() and toString() methods.
 */
@Test
public void testEquality() {
    TunnelEndPoint src = IpTunnelEndPoint.ipTunnelPoint(IpAddress.valueOf(23423));
    TunnelEndPoint dst = IpTunnelEndPoint.ipTunnelPoint(IpAddress.valueOf(32421));
    ApplicationId appId = new DefaultApplicationId(243, "test");
    ApplicationId appId2 = new DefaultApplicationId(2431, "test1");
    TunnelId tunnelId = TunnelId.valueOf("41654654");
    TunnelSubscription p1 = new TunnelSubscription(appId, src, dst, tunnelId, Tunnel.Type.VXLAN,
                         null);
    TunnelSubscription p2 = new TunnelSubscription(appId, src, dst, tunnelId, Tunnel.Type.VXLAN,
                         null);
    TunnelSubscription p3 = new TunnelSubscription(appId2, src, dst, tunnelId, Tunnel.Type.VXLAN,
                         null);
    new EqualsTester().addEqualityGroup(p1, p2).addEqualityGroup(p3)
            .testEquals();
}
 
Example #15
Source File: WallClockTimestampTest.java    From onos with Apache License 2.0 6 votes vote down vote up
@Test
public final void testKryoSerializable() {
    WallClockTimestamp ts1 = new WallClockTimestamp();
    WallClockTimestamp ts2 = new WallClockTimestamp(System.currentTimeMillis() + 10000);
    final ByteBuffer buffer = ByteBuffer.allocate(1 * 1024 * 1024);
    final KryoNamespace kryos = KryoNamespace.newBuilder()
            .register(WallClockTimestamp.class)
            .build();

    kryos.serialize(ts1, buffer);
    buffer.flip();
    Timestamp copy = kryos.deserialize(buffer);

    new EqualsTester()
            .addEqualityGroup(ts1, copy)
            .addEqualityGroup(ts2)
            .testEquals();
}
 
Example #16
Source File: PiPacketMetadataTest.java    From onos with Apache License 2.0 5 votes vote down vote up
/**
 * Checks the operation of equals(), hashCode() and toString() methods.
 */
@Test
public void testEquals() {

    new EqualsTester()
            .addEqualityGroup(piPacketMetadata1, sameAsPiPacketMetadata1)
            .addEqualityGroup(piPacketMetadata2)
            .testEquals();
}
 
Example #17
Source File: SetOriginTest.java    From batfish with Apache License 2.0 5 votes vote down vote up
@Test
public void testEquals() {
  SetOrigin so = new SetOrigin(new LiteralOrigin(OriginType.INCOMPLETE, 1L));
  new EqualsTester()
      .addEqualityGroup(so, so, new SetOrigin(new LiteralOrigin(OriginType.INCOMPLETE, 1L)))
      .addEqualityGroup(new SetOrigin(new LiteralOrigin(OriginType.IGP, 1L)))
      .addEqualityGroup(new Object())
      .testEquals();
}
 
Example #18
Source File: PacketInEventTest.java    From onos with Apache License 2.0 5 votes vote down vote up
/**
 * Checks the operation of equals(), hashCode() and toString() methods.
 */
@Test
public void testEquals() {
    new EqualsTester()
            .addEqualityGroup(packetIn, sameAsPacketIn)
            .addEqualityGroup(packetIn2)
            .addEqualityGroup(packetIn3)
            .testEquals();
}
 
Example #19
Source File: WarningTest.java    From batfish with Apache License 2.0 5 votes vote down vote up
@Test
public void testEquals() {
  new EqualsTester()
      .addEqualityGroup(new Warning("a", "b"), new Warning("a", "b"))
      .addEqualityGroup(new Warning("a", null))
      .addEqualityGroup(new Warning("a", "c"))
      .testEquals();
}
 
Example #20
Source File: UVariableDeclTest.java    From Refaster with Apache License 2.0 5 votes vote down vote up
@Test
public void equality() {
  new EqualsTester()
      .addEqualityGroup(
          UVariableDecl.create("foo", UClassIdent.create("java.lang.String"), null))
      .addEqualityGroup(UVariableDecl.create("foo", 
          UClassIdent.create("java.lang.String"), ULiteral.stringLit("bar")))
      .addEqualityGroup(
          UVariableDecl.create("foo", UClassIdent.create("java.lang.Integer"), null))
      .addEqualityGroup(
          UVariableDecl.create("baz", UClassIdent.create("java.lang.String"), null))
      .testEquals();
}
 
Example #21
Source File: IPv4RouterIdOfLocalNodeSubTlvTest.java    From onos with Apache License 2.0 5 votes vote down vote up
@Test
public void basics() {
    new EqualsTester()
    .addEqualityGroup(tlv1, sameAsTlv1)
    .addEqualityGroup(tlv2)
    .testEquals();
}
 
Example #22
Source File: PiTernaryFieldMatchTest.java    From onos with Apache License 2.0 5 votes vote down vote up
/**
 * Checks the operation of equals(), hashCode() and toString() methods.
 */
@Test
public void testEquals() {
    new EqualsTester()
            .addEqualityGroup(piTernaryFieldMatch1, sameAsPiTernaryFieldMatch1)
            .addEqualityGroup(piTernaryFieldMatch2)
            .testEquals();
}
 
Example #23
Source File: DefaultFlowInfoTest.java    From onos with Apache License 2.0 5 votes vote down vote up
/**
 * Tests object equality.
 */
@Test
public void testEquality() {
    new EqualsTester()
            .addEqualityGroup(info1, sameAsInfo1)
            .addEqualityGroup(info2).testEquals();
}
 
Example #24
Source File: IntegerValueRenderingTest.java    From batfish with Apache License 2.0 5 votes vote down vote up
@Test
public void testEquals() {
  new EqualsTester()
      .addEqualityGroup(IntegerValueRendering.instance())
      .addEqualityGroup(new Object())
      .testEquals();
}
 
Example #25
Source File: AppendTrieDictionaryTest.java    From kylin with Apache License 2.0 5 votes vote down vote up
@Test
public void testEqualsAndHashCode() throws IOException {
    AppendTrieDictionaryBuilder builder = createBuilder();
    AppendTrieDictionary dict1 = builder.build(0);
    AppendTrieDictionary dict2 = builder.build(1);

    int maxEntriesPerSlice = KylinConfig.getInstanceFromEnv().getAppendDictEntrySize();
    String tempBaseDir = KylinConfig.getInstanceFromEnv().getHdfsWorkingDirectory() + "/resources/GlobalDict"
            + "/dict/append_dict_test/" + RandomUtil.randomUUID() + "/";
    AppendTrieDictionaryBuilder builder2 = new AppendTrieDictionaryBuilder(tempBaseDir, maxEntriesPerSlice, true);
    AppendTrieDictionary dict3 = builder2.build(0);
    AppendTrieDictionary dict4 = builder2.build(1);

    new EqualsTester().addEqualityGroup(dict1, dict2).addEqualityGroup(dict3, dict4).testEquals();
}
 
Example #26
Source File: BusbarSectionContingencyTest.java    From powsybl-core with Mozilla Public License 2.0 5 votes vote down vote up
@Test
public void test() {
    BusbarSectionContingency contingency = new BusbarSectionContingency("id");
    assertEquals("id", contingency.getId());
    assertEquals(ContingencyElementType.BUSBAR_SECTION, contingency.getType());

    assertNotNull(contingency.toTask());
    assertTrue(contingency.toTask() instanceof BusbarSectionTripping);

    new EqualsTester()
            .addEqualityGroup(new BusbarSectionContingency("bbs1"), new BusbarSectionContingency("bbs1"))
            .addEqualityGroup(new BusbarSectionContingency("bbs2"), new BusbarSectionContingency("bbs2"))
            .testEquals();

}
 
Example #27
Source File: DefaultPortPairTest.java    From onos with Apache License 2.0 5 votes vote down vote up
/**
 * Checks the operation of equals() methods.
 */
@Test
public void testEquals() {
    // Create same two port pair objects.
    final PortPairId portPairId = PortPairId.of("78888888-fc23-aeb6-f44b-56dc5e2fb3ae");
    final TenantId tenantId = TenantId.tenantId("1");
    final String name = "PortPair1";
    final String description = "PortPair1";
    final String ingress = "d3333333-24fc-4fae-af4b-321c5e2eb3d1";
    final String egress = "a4444444-4a56-2a6e-cd3a-9dee4e2ec345";

    DefaultPortPair.Builder portPairBuilder = new DefaultPortPair.Builder();
    final PortPair portPair1 = portPairBuilder.setId(portPairId).setTenantId(tenantId).setName(name)
            .setDescription(description).setIngress(ingress).setEgress(egress).build();

    portPairBuilder = new DefaultPortPair.Builder();
    final PortPair samePortPair1 = portPairBuilder.setId(portPairId).setTenantId(tenantId).setName(name)
            .setDescription(description).setIngress(ingress).setEgress(egress).build();

    // Create different port pair object.
    final PortPairId portPairId2 = PortPairId.of("79999999-fc23-aeb6-f44b-56dc5e2fb3ae");
    final TenantId tenantId2 = TenantId.tenantId("2");
    final String name2 = "PortPair2";
    final String description2 = "PortPair2";
    final String ingress2 = "d5555555-24fc-4fae-af4b-321c5e2eb3d1";
    final String egress2 = "a6666666-4a56-2a6e-cd3a-9dee4e2ec345";

    portPairBuilder = new DefaultPortPair.Builder();
    final PortPair portPair2 = portPairBuilder.setId(portPairId2).setTenantId(tenantId2).setName(name2)
            .setDescription(description2).setIngress(ingress2).setEgress(egress2).build();

    new EqualsTester().addEqualityGroup(portPair1, samePortPair1).addEqualityGroup(portPair2).testEquals();
}
 
Example #28
Source File: LispGcAddressTest.java    From onos with Apache License 2.0 5 votes vote down vote up
@Test
public void testSerialization() {
    LispGcAddress other = new LispGcAddress();
    other.deserialize(address1.serialize());

    new EqualsTester()
            .addEqualityGroup(address1, other)
            .testEquals();
}
 
Example #29
Source File: PiRangeFieldMatchTest.java    From onos with Apache License 2.0 5 votes vote down vote up
/**
 * Checks the operation of equals(), hashCode() and toString() methods.
 */
@Test
public void testEquals() {
    new EqualsTester()
            .addEqualityGroup(piRangeFieldMatch1, sameAsPiRangeFieldMatch1)
            .addEqualityGroup(piRangeFieldMatch2)
            .testEquals();
}
 
Example #30
Source File: NodeCalcEqualsTest.java    From powsybl-core with Mozilla Public License 2.0 5 votes vote down vote up
@Test
public void unaryOperationTest() {
    new EqualsTester()
            .addEqualityGroup(UnaryOperation.negative(new IntegerNodeCalc(1)),
                              UnaryOperation.negative(new IntegerNodeCalc(1)))
            .addEqualityGroup(UnaryOperation.negative(new IntegerNodeCalc(3)),
                              UnaryOperation.negative(new IntegerNodeCalc(3)))
            .testEquals();
}