コード例 #1
0
 @Test
 public void
     succeed_whenTheExceptionIsThrownInADifficultToReachPartOfTheSubclassOfAVersionedEntity_givenIdenticalCopyForVersionedEntityWarningIsSuppressed() {
   EqualsVerifier.forClass(NonReflexiveCanEqualVersionedEntity.class)
       .suppress(Warning.IDENTICAL_COPY_FOR_VERSIONED_ENTITY)
       .verify();
 }
コード例 #2
0
 @Test
 public void testEqualsContract() {
   EqualsVerifier.forClass(Ipv4.class)
       .suppress(Warning.NULL_FIELDS)
       .withRedefinedSuperclass()
       .verify();
 }
コード例 #3
0
 @Test
 public void testEqualsAndHashCode() {
   EqualsVerifier.forClass(SuppressElement.class)
       .usingGetClass()
       .suppress(Warning.NONFINAL_FIELDS)
       .verify();
 }
コード例 #4
0
 @Test
 public void fail_whenInstanceWithANonzeroIdEqualsItself_givenIdenticalCopyWarningIsSuppressed() {
   expectFailure("Unnecessary suppression", Warning.IDENTICAL_COPY.toString());
   EqualsVerifier.forClass(OtherwiseStatelessVersionedEntity.class)
       .suppress(Warning.IDENTICAL_COPY)
       .verify();
 }
コード例 #5
0
 @Test
 public void
     succeed_whenInstanceWithAZeroIdDoesNotEqualItselfAndInstanceWithANonzeroIdDoes_givenIdenticalCopyForVersionedEntityWarningIsSuppressed() {
   EqualsVerifier.forClass(VersionedEntity.class)
       .suppress(Warning.IDENTICAL_COPY_FOR_VERSIONED_ENTITY)
       .verify();
 }
コード例 #6
0
 @Test
 public void
     fail_whenTheExceptionIsThrownInADifficultToReachPartOfTheSubclassOfAVersionedEntity_givenVersionedEntityWarningIsSuppressed() {
   expectFailure("catch me if you can");
   EqualsVerifier.forClass(NonReflexiveCanEqualVersionedEntity.class)
       .suppress(Warning.IDENTICAL_COPY_FOR_VERSIONED_ENTITY)
       .verify();
 }
コード例 #7
0
 @Test
 public void shouldRespectEqualsContract() {
   EqualsVerifier.forClass(FcNetwork.class)
       .withRedefinedSuperclass()
       .suppress(Warning.NONFINAL_FIELDS)
       .suppress(Warning.NULL_FIELDS)
       .verify();
 }
コード例 #8
0
 @Test
 // CHECKSTYLE: ignore LineLength for 1 line.
 public void
     succeed_whenInstanceWithAZeroIdCanEqualItselfAndInstanceWithANonzeroIdAlso_givenAVersionedEntityWithStateAndAllFieldsWarningIsSuppressed() {
   EqualsVerifier.forClass(WeakStringVersionedEntity.class)
       .suppress(Warning.ALL_FIELDS_SHOULD_BE_USED)
       .verify();
 }
コード例 #9
0
 @Test
 // CHECKSTYLE: ignore LineLength for 1 line.
 public void
     succeed_whenInstanceWithAZeroIdCanEqualItselfAndInstanceWithANonzeroIdAlso_givenAVersionedEntityWithStateAndVersionedEntityWarningIsSuppressed() {
   EqualsVerifier.forClass(WeakStringVersionedEntity.class)
       .suppress(Warning.IDENTICAL_COPY_FOR_VERSIONED_ENTITY)
       .verify();
 }
コード例 #10
0
 @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();
 }
コード例 #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)));
 }
コード例 #12
0
 @Test
 public void fail_whenOnlyHashCodeIsAbstractInSuperclass() {
   expectFailure(
       ABSTRACT_DELEGATION,
       HASHCODE_IS_ABSTRACT,
       EQUALS_IS_NOT,
       AbstractHashCodeButNotEquals.class.getSimpleName());
   EqualsVerifier.forClass(SubclassOfAbstractHashCodeButNotEquals.class).verify();
 }
コード例 #13
0
 @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();
 }
コード例 #14
0
  @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();
  }
コード例 #15
0
  @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();
  }
コード例 #16
0
 @Test
 public void shouldObeyHashcodeEqualsContract() {
   EqualsVerifier.forClass(MutationIdentifier.class).verify();
 }
コード例 #17
0
 @Test
 public void succeed_whenBothAreAbstractInSuperclassOfSuperclass() {
   EqualsVerifier.forClass(SubclassOfSubclassOfAbstractBoth.class).verify();
 }
コード例 #18
0
 @Test
 public void fail_whenHashCodeIsAbstract() {
   expectFailure(HASHCODE_IS_ABSTRACT, EQUALS_IS_NOT, AbstractHashCode.class.getSimpleName());
   EqualsVerifier.forClass(AbstractHashCode.class).verify();
 }
コード例 #19
0
 @Test
 public void fail_whenBothEqualsAndHashCodeAreAbstract() {
   expectFailure(BOTH_ARE_ABSTRACT, AbstractBoth.class.getSimpleName());
   EqualsVerifier.forClass(AbstractBoth.class).verify();
 }
コード例 #20
0
 @Test
 public void hashCodeEqualsTest() {
   EqualsVerifier.forClass(MongoNotification.class).suppress(Warning.NONFINAL_FIELDS).verify();
 }
コード例 #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);
 }
コード例 #23
0
ファイル: ServerTest.java プロジェクト: hardiku/iep
 @Test
 public void equalsContract() {
   EqualsVerifier.forClass(Server.class).suppress(Warning.NULL_FIELDS).verify();
 }
コード例 #24
0
ファイル: MetaTest.java プロジェクト: ronsmits/openkeepass
 @Test
 public void equalsContract() {
   EqualsVerifier.forClass(Meta.class).suppress(Warning.NONFINAL_FIELDS).verify();
 }
コード例 #25
0
ファイル: DocumentTest.java プロジェクト: croesch/oblodiff
 @Test
 public void equalsAndHashCode() {
   // Null is avoided by validation in constructor.
   EqualsVerifier.forClass(Document.class).suppress(Warning.NULL_FIELDS).verify();
 }
コード例 #26
0
 @Test
 public void verifyEquals() {
   EqualsVerifier.forClass(ApiCacheKey.class).verify();
 }
コード例 #27
0
  @Test
  public void testEquals() {

    EqualsVerifier.forClass(VersionResponse.class).suppress(Warning.NONFINAL_FIELDS).verify();
  }
コード例 #28
0
 @Test
 public final void testEquals() {
   EqualsVerifier.forClass(UtilizationSummary.class).verify();
 }
コード例 #29
0
 @Test
 public void testEqualsAndHashCode() {
   EqualsVerifier.forClass(AgeGroup.class).verify();
 }
コード例 #30
0
 @Test
 public void shouldMeetEqualsAndHashCodeContract() {
   // expect
   EqualsVerifier.forClass(InternalWebsNews.class).withRedefinedSuperclass().verify();
 }