@Test
 public void
     succeed_whenTheExceptionIsThrownInADifficultToReachPartOfTheSubclassOfAVersionedEntity_givenIdenticalCopyForVersionedEntityWarningIsSuppressed() {
   EqualsVerifier.forClass(NonReflexiveCanEqualVersionedEntity.class)
       .suppress(Warning.IDENTICAL_COPY_FOR_VERSIONED_ENTITY)
       .verify();
 }
Ejemplo n.º 2
0
 @Test
 public void testEqualsContract() {
   EqualsVerifier.forClass(Ipv4.class)
       .suppress(Warning.NULL_FIELDS)
       .withRedefinedSuperclass()
       .verify();
 }
 @Test
 public void testEqualsAndHashCode() {
   EqualsVerifier.forClass(SuppressElement.class)
       .usingGetClass()
       .suppress(Warning.NONFINAL_FIELDS)
       .verify();
 }
 @Test
 public void fail_whenInstanceWithANonzeroIdEqualsItself_givenIdenticalCopyWarningIsSuppressed() {
   expectFailure("Unnecessary suppression", Warning.IDENTICAL_COPY.toString());
   EqualsVerifier.forClass(OtherwiseStatelessVersionedEntity.class)
       .suppress(Warning.IDENTICAL_COPY)
       .verify();
 }
 @Test
 public void
     succeed_whenInstanceWithAZeroIdDoesNotEqualItselfAndInstanceWithANonzeroIdDoes_givenIdenticalCopyForVersionedEntityWarningIsSuppressed() {
   EqualsVerifier.forClass(VersionedEntity.class)
       .suppress(Warning.IDENTICAL_COPY_FOR_VERSIONED_ENTITY)
       .verify();
 }
 @Test
 public void
     fail_whenTheExceptionIsThrownInADifficultToReachPartOfTheSubclassOfAVersionedEntity_givenVersionedEntityWarningIsSuppressed() {
   expectFailure("catch me if you can");
   EqualsVerifier.forClass(NonReflexiveCanEqualVersionedEntity.class)
       .suppress(Warning.IDENTICAL_COPY_FOR_VERSIONED_ENTITY)
       .verify();
 }
 @Test
 public void shouldRespectEqualsContract() {
   EqualsVerifier.forClass(FcNetwork.class)
       .withRedefinedSuperclass()
       .suppress(Warning.NONFINAL_FIELDS)
       .suppress(Warning.NULL_FIELDS)
       .verify();
 }
 @Test
 // CHECKSTYLE: ignore LineLength for 1 line.
 public void
     succeed_whenInstanceWithAZeroIdCanEqualItselfAndInstanceWithANonzeroIdAlso_givenAVersionedEntityWithStateAndAllFieldsWarningIsSuppressed() {
   EqualsVerifier.forClass(WeakStringVersionedEntity.class)
       .suppress(Warning.ALL_FIELDS_SHOULD_BE_USED)
       .verify();
 }
 @Test
 // CHECKSTYLE: ignore LineLength for 1 line.
 public void
     succeed_whenInstanceWithAZeroIdCanEqualItselfAndInstanceWithANonzeroIdAlso_givenAVersionedEntityWithStateAndVersionedEntityWarningIsSuppressed() {
   EqualsVerifier.forClass(WeakStringVersionedEntity.class)
       .suppress(Warning.IDENTICAL_COPY_FOR_VERSIONED_ENTITY)
       .verify();
 }
 @Test
 public void ContainerEqualsContract() throws NoSuchFieldException {
   EqualsVerifier.forClass(Container.class)
       .withPrefabValues(RequestParams.class, new RequestParams(null), new RequestParams(null))
       .usingGetClass()
       .suppress(Warning.NONFINAL_FIELDS)
       .verify();
 }
Ejemplo n.º 11
0
 /*
  * (non-Javadoc)
  * @see eu.stratosphere.sopremo.expressions.OrExpressionTest#initVerifier(nl.jqno.equalsverifier.EqualsVerifier)
  */
 @Override
 protected void initVerifier(final EqualsVerifier<ArrayCreation> equalVerifier) {
   super.initVerifier(equalVerifier);
   equalVerifier.withPrefabValues(
       List.class,
       new ArrayList<Object>(),
       new ArrayList<EvaluationExpression>(Collections.singleton(EvaluationExpression.VALUE)));
 }
 @Test
 public void fail_whenOnlyHashCodeIsAbstractInSuperclass() {
   expectFailure(
       ABSTRACT_DELEGATION,
       HASHCODE_IS_ABSTRACT,
       EQUALS_IS_NOT,
       AbstractHashCodeButNotEquals.class.getSimpleName());
   EqualsVerifier.forClass(SubclassOfAbstractHashCodeButNotEquals.class).verify();
 }
 @Test
 public void RelationshipContainerContainerEqualsContract() throws NoSuchFieldException {
   EqualsVerifier.forClass(RelationshipContainer.class)
       .withPrefabValues(
           Field.class,
           String.class.getDeclaredField("value"),
           String.class.getDeclaredField("hash"))
       .usingGetClass()
       .suppress(Warning.NONFINAL_FIELDS)
       .verify();
 }
  @Test
  public void testEquals() throws Exception {

    // Checks a number of standard properties of the equals contract
    EqualsVerifier.forClass(MultiLineStringTo.class)
        .withRedefinedSuperclass()
        .suppress(Warning.NONFINAL_FIELDS)
        .verify();

    CrsTo crsTo1 = ToTestHelper.createCrsTo("EPSG:900913");
    CrsTo crsTo2 = ToTestHelper.createCrsTo("EPSG:4326");

    MultiLineStringTo first = null;
    MultiLineStringTo second = null;

    // Equal objects
    first = new MultiLineStringTo(crsTo1, new double[][][] {{{1, 2}, {3, 4}}, {{5, 6}, {7, 8}}});
    second = new MultiLineStringTo(crsTo1, new double[][][] {{{1, 2}, {3, 4}}, {{5, 6}, {7, 8}}});
    Assert.assertTrue(first.equals(second));
    Assert.assertTrue(second.equals(first));

    // Different CRS
    first = new MultiLineStringTo(crsTo1, new double[][][] {{{1, 2}, {3, 4}}, {{5, 6}, {7, 8}}});
    second = new MultiLineStringTo(crsTo2, new double[][][] {{{1, 2}, {3, 4}}, {{5, 6}, {7, 8}}});
    EqualsVerifier.forExamples(first, second)
        .withRedefinedSuperclass()
        .suppress(Warning.NONFINAL_FIELDS)
        .verify();

    // Different Coordinates
    first = new MultiLineStringTo(crsTo1, new double[][][] {{{1, 2}, {3, 4}}, {{5, 6}, {7, 8}}});
    second = new MultiLineStringTo(crsTo1, new double[][][] {{{9, 2}, {3, 4}}, {{5, 6}, {7, 8}}});
    EqualsVerifier.forExamples(first, second)
        .withRedefinedSuperclass()
        .suppress(Warning.NONFINAL_FIELDS)
        .verify();
  }
  @Test
  public void LinkageContainerContainerEqualsContract() throws NoSuchFieldException {
    ResourceInformation resourceInformationRed =
        new ResourceInformation(String.class, null, null, null);
    ResourceInformation resourceInformationBlack =
        new ResourceInformation(Integer.class, null, null, null);

    @SuppressWarnings("unchecked")
    RegistryEntry registryEntryRed = new RegistryEntry(resourceInformationRed, null, null);
    @SuppressWarnings("unchecked")
    RegistryEntry registryEntryBlack = new RegistryEntry(resourceInformationBlack, null, null);

    EqualsVerifier.forClass(LinkageContainer.class)
        .withPrefabValues(
            Field.class,
            String.class.getDeclaredField("value"),
            String.class.getDeclaredField("hash"))
        .withPrefabValues(
            ResourceInformation.class, resourceInformationRed, resourceInformationBlack)
        .withPrefabValues(RegistryEntry.class, registryEntryRed, registryEntryBlack)
        .usingGetClass()
        .suppress(Warning.NONFINAL_FIELDS)
        .verify();
  }
Ejemplo n.º 16
0
 @Test
 public void shouldObeyHashcodeEqualsContract() {
   EqualsVerifier.forClass(MutationIdentifier.class).verify();
 }
 @Test
 public void succeed_whenBothAreAbstractInSuperclassOfSuperclass() {
   EqualsVerifier.forClass(SubclassOfSubclassOfAbstractBoth.class).verify();
 }
 @Test
 public void fail_whenHashCodeIsAbstract() {
   expectFailure(HASHCODE_IS_ABSTRACT, EQUALS_IS_NOT, AbstractHashCode.class.getSimpleName());
   EqualsVerifier.forClass(AbstractHashCode.class).verify();
 }
 @Test
 public void fail_whenBothEqualsAndHashCodeAreAbstract() {
   expectFailure(BOTH_ARE_ABSTRACT, AbstractBoth.class.getSimpleName());
   EqualsVerifier.forClass(AbstractBoth.class).verify();
 }
Ejemplo n.º 20
0
 @Test
 public void hashCodeEqualsTest() {
   EqualsVerifier.forClass(MongoNotification.class).suppress(Warning.NONFINAL_FIELDS).verify();
 }
Ejemplo n.º 21
0
 @Test
 public void verifyEqualsAndHashCodeImplementation() {
   EqualsVerifier.forClass(DeleteResults.class).allFieldsShouldBeUsed().verify();
 }
 @Override
 protected void initVerifier(final EqualsVerifier<T> equalVerifier) {
   super.initVerifier(equalVerifier);
   equalVerifier.suppress(Warning.TRANSIENT_FIELDS);
 }
Ejemplo n.º 23
0
 @Test
 public void equalsContract() {
   EqualsVerifier.forClass(Server.class).suppress(Warning.NULL_FIELDS).verify();
 }
Ejemplo n.º 24
0
 @Test
 public void equalsContract() {
   EqualsVerifier.forClass(Meta.class).suppress(Warning.NONFINAL_FIELDS).verify();
 }
Ejemplo n.º 25
0
 @Test
 public void equalsAndHashCode() {
   // Null is avoided by validation in constructor.
   EqualsVerifier.forClass(Document.class).suppress(Warning.NULL_FIELDS).verify();
 }
Ejemplo n.º 26
0
 @Test
 public void verifyEquals() {
   EqualsVerifier.forClass(ApiCacheKey.class).verify();
 }
  @Test
  public void testEquals() {

    EqualsVerifier.forClass(VersionResponse.class).suppress(Warning.NONFINAL_FIELDS).verify();
  }
Ejemplo n.º 28
0
 @Test
 public final void testEquals() {
   EqualsVerifier.forClass(UtilizationSummary.class).verify();
 }
 @Test
 public void testEqualsAndHashCode() {
   EqualsVerifier.forClass(AgeGroup.class).verify();
 }
Ejemplo n.º 30
0
 @Test
 public void shouldMeetEqualsAndHashCodeContract() {
   // expect
   EqualsVerifier.forClass(InternalWebsNews.class).withRedefinedSuperclass().verify();
 }