nl.jqno.equalsverifier.Warning Java Examples

The following examples show how to use nl.jqno.equalsverifier.Warning. 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: SortSpecTest.java    From crnk-framework with Apache License 2.0 6 votes vote down vote up
@Test
public void testEquals() {
	EqualsVerifier.forClass(SortSpec.class).usingGetClass().suppress(Warning.NONFINAL_FIELDS).verify();

	SortSpec spec1 = new SortSpec(Arrays.asList("name1"), Direction.ASC);
	SortSpec spec2 = new SortSpec(Arrays.asList("name1"), Direction.ASC);
	SortSpec spec3 = new SortSpec(Arrays.asList("name2"), Direction.ASC);
	SortSpec spec4 = new SortSpec(Arrays.asList("name1"), Direction.DESC);

	Assert.assertEquals(spec1, spec1);
	Assert.assertEquals(spec3, spec3);
	Assert.assertEquals(spec1, spec2);
	Assert.assertEquals(spec2, spec1);
	Assert.assertEquals(spec1.hashCode(), spec1.hashCode());
	Assert.assertEquals(spec3.hashCode(), spec3.hashCode());
	Assert.assertEquals(spec1.hashCode(), spec2.hashCode());
	Assert.assertNotEquals(spec2, spec3);
	Assert.assertNotEquals(spec3, spec2);
	Assert.assertNotEquals(spec1, spec4);
	Assert.assertNotEquals(spec3, spec4);

	Assert.assertEquals(spec1, SortSpec.asc(Arrays.asList("name1")));
	Assert.assertEquals(spec4, SortSpec.desc(Arrays.asList("name1")));
	Assert.assertNotEquals(spec1, null);
	Assert.assertNotEquals(spec1, "test");
}
 
Example #2
Source File: ParsedTransactionMessageTest.java    From exonum-java-binding with Apache License 2.0 6 votes vote down vote up
@Test
void testEquals() throws InvalidProtocolBufferException {
  String red = "Red";
  String black = "Black";
  EqualsVerifier.forClass(ParsedTransactionMessage.class)
      // Fields are non-null
      .suppress(Warning.NULL_FIELDS)
      // Only the source signedMessage is compared
      .withOnlyTheseFields("signedMessage")
      .withPrefabValues(Messages.SignedMessage.class,
          signedConsensusMessage(red),
          signedConsensusMessage(black))
      .withPrefabValues(SignedMessage.class,
          signedMessage(red),
          signedMessage(black))
      .withPrefabValues(AnyTx.class,
          anyTx(red),
          anyTx(black))
      .verify();
}
 
Example #3
Source File: EqualsVerifierParityResponseTest.java    From etherscan-explorer with GNU General Public License v3.0 5 votes vote down vote up
@Test
public void testChangedState() {
    EqualsVerifier.forClass(StateDiff.ChangedState.class)
            .suppress(Warning.NONFINAL_FIELDS)
            .suppress(Warning.STRICT_INHERITANCE)
            .verify();
}
 
Example #4
Source File: ImmutableThingPlaceholderTest.java    From ditto with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Test hash code and equals.
 */
@Test
public void testHashCodeAndEquals() {
    EqualsVerifier.forClass(ImmutableThingPlaceholder.class)
            .suppress(Warning.INHERITED_DIRECTLY_FROM_OBJECT)
            .usingGetClass()
            .verify();
}
 
Example #5
Source File: EqualsVerifierParityResponseTest.java    From etherscan-explorer with GNU General Public License v3.0 5 votes vote down vote up
@Test
public void testVMTraceVMOperationExStore() {
    EqualsVerifier.forClass(VMTrace.VMOperation.Ex.Store.class)
            .suppress(Warning.NONFINAL_FIELDS)
            .suppress(Warning.STRICT_INHERITANCE)
            .verify();
}
 
Example #6
Source File: EqualsVerifierParityResponseTest.java    From etherscan-explorer with GNU General Public License v3.0 5 votes vote down vote up
@Test
public void testVMTraceVMOperationExMem() {
    EqualsVerifier.forClass(VMTrace.VMOperation.Ex.Mem.class)
            .suppress(Warning.NONFINAL_FIELDS)
            .suppress(Warning.STRICT_INHERITANCE)
            .verify();
}
 
Example #7
Source File: ImmutableTopicPathPlaceholderTest.java    From ditto with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Test hash code and equals.
 */
@Test
public void testHashCodeAndEquals() {
    EqualsVerifier.forClass(ImmutableTopicPathPlaceholder.class)
            .suppress(Warning.INHERITED_DIRECTLY_FROM_OBJECT)
            .usingGetClass()
            .verify();
}
 
Example #8
Source File: EqualsVerifierParityResponseTest.java    From etherscan-explorer with GNU General Public License v3.0 5 votes vote down vote up
@Test
public void testTraceResult() {
    EqualsVerifier.forClass(Trace.Result.class)
            .suppress(Warning.NONFINAL_FIELDS)
            .suppress(Warning.STRICT_INHERITANCE)
            .verify();
}
 
Example #9
Source File: ImmutableJsonLiteralTest.java    From ditto with Eclipse Public License 2.0 5 votes vote down vote up
@Test
public void testHashCodeAndEquals() {
    final SoftReference<JsonValue> red = new SoftReference<>(ImmutableJsonBoolean.TRUE);
    final SoftReference<JsonValue> black = new SoftReference<>(ImmutableJsonBoolean.FALSE);

    EqualsVerifier.forClass(ImmutableJsonBoolean.class)
            .withRedefinedSuperclass()
            .withPrefabValues(SoftReference.class, red, black)
            .suppress(Warning.REFERENCE_EQUALITY)
            .verify();
}
 
Example #10
Source File: ResourceNodeTest.java    From ditto with Eclipse Public License 2.0 5 votes vote down vote up
/** */
@Test
public void testHashCodeAndEquals() {
    EqualsVerifier.forClass(ResourceNode.class)
            .withRedefinedSuperclass()
            .suppress(Warning.NONFINAL_FIELDS)
            .withIgnoredFields("absolutePointer")
            .verify();
}
 
Example #11
Source File: MapEntryTest.java    From exonum-java-binding with Apache License 2.0 5 votes vote down vote up
@Test
void verifyEquals() {
  EqualsVerifier.forClass(MapEntry.class)
      .usingGetClass()
      .suppress(Warning.INHERITED_DIRECTLY_FROM_OBJECT)
      .withPrefabValues(
          ByteString.class, ByteString.copyFromUtf8("a"), ByteString.copyFromUtf8("b"))
      .verify();
}
 
Example #12
Source File: ImmutableFunctionExpressionTest.java    From ditto with Eclipse Public License 2.0 5 votes vote down vote up
@Test
public void testHashCodeAndEquals() {
    EqualsVerifier.forClass(ImmutableFunctionExpression.class)
            .suppress(Warning.INHERITED_DIRECTLY_FROM_OBJECT)
            .usingGetClass()
            .verify();
}
 
Example #13
Source File: GameSettingsTest.java    From ocraft-s2client with MIT License 5 votes vote down vote up
@Test
void fulfillsEqualsContract() {
    EqualsVerifier.forClass(GameSettings.class)
            .suppress(Warning.NONFINAL_FIELDS)
            .withPrefabValues(S2Client.class, mock(S2Client.class), mock(S2Client.class))
            .verify();
}
 
Example #14
Source File: ReplaySettingsTest.java    From ocraft-s2client with MIT License 5 votes vote down vote up
@Test
void fulfillsEqualsContract() {
    EqualsVerifier.forClass(ReplaySettings.class)
            .suppress(Warning.NONFINAL_FIELDS)
            .withNonnullFields("replayFiles")
            .verify();
}
 
Example #15
Source File: EqualsVerifierParityResponseTest.java    From etherscan-explorer with GNU General Public License v3.0 5 votes vote down vote up
@Test
public void testTraceCreateAction() {
    EqualsVerifier.forClass(Trace.CreateAction.class)
            .suppress(Warning.NONFINAL_FIELDS)
            .suppress(Warning.STRICT_INHERITANCE)
            .verify();
}
 
Example #16
Source File: EqualsVerifierParityResponseTest.java    From etherscan-explorer with GNU General Public License v3.0 5 votes vote down vote up
@Test
public void testAddedState() {
    EqualsVerifier.forClass(StateDiff.AddedState.class)
            .suppress(Warning.NONFINAL_FIELDS)
            .suppress(Warning.STRICT_INHERITANCE)
            .verify();
}
 
Example #17
Source File: EqualsVerifierParityResponseTest.java    From etherscan-explorer with GNU General Public License v3.0 5 votes vote down vote up
@Test
public void testUnchangedState() {
    EqualsVerifier.forClass(StateDiff.UnchangedState.class)
            .suppress(Warning.NONFINAL_FIELDS)
            .suppress(Warning.STRICT_INHERITANCE)
            .verify();
}
 
Example #18
Source File: EqualsVerifierParityResponseTest.java    From etherscan-explorer with GNU General Public License v3.0 5 votes vote down vote up
@Test
public void testVMTrace() {
    VMTrace.VMOperation op1 = new VMTrace.VMOperation(
            null, BigInteger.ZERO, null, null);
    VMTrace.VMOperation op2 = new VMTrace.VMOperation(
            null, BigInteger.ONE, null, null);

    EqualsVerifier.forClass(VMTrace.class)
            .withPrefabValues(VMTrace.VMOperation.class, op1, op2)
            .suppress(Warning.NONFINAL_FIELDS)
            .suppress(Warning.STRICT_INHERITANCE)
            .verify();
}
 
Example #19
Source File: EqualsVerifierParityResponseTest.java    From etherscan-explorer with GNU General Public License v3.0 5 votes vote down vote up
@Test
public void testStateDiff() {
    EqualsVerifier.forClass(StateDiff.class)
            .suppress(Warning.NONFINAL_FIELDS)
            .suppress(Warning.STRICT_INHERITANCE)
            .verify();
}
 
Example #20
Source File: EqualsVerifierParityResponseTest.java    From etherscan-explorer with GNU General Public License v3.0 5 votes vote down vote up
@Test
public void testAccountsInfo() {
    EqualsVerifier.forClass(ParityAllAccountsInfo.AccountsInfo.class)
            .suppress(Warning.NONFINAL_FIELDS)
            .suppress(Warning.STRICT_INHERITANCE)
            .verify();
}
 
Example #21
Source File: ModifyPolicyIdTest.java    From ditto with Eclipse Public License 2.0 5 votes vote down vote up
@Test
public void testHashCodeAndEquals() {
    EqualsVerifier.forClass(ModifyPolicyId.class)
            .withRedefinedSuperclass()
            .suppress(Warning.REFERENCE_EQUALITY)
            .verify();
}
 
Example #22
Source File: EqualsVerifierResponseTest.java    From etherscan-explorer with GNU General Public License v3.0 5 votes vote down vote up
@Test
public void testCompiledSolidityCode() {
    EqualsVerifier.forClass(EthCompileSolidity.Code.class)
            .suppress(Warning.NONFINAL_FIELDS)
            .suppress(Warning.STRICT_INHERITANCE)
            .verify();
}
 
Example #23
Source File: EqualsVerifierResponseTest.java    From etherscan-explorer with GNU General Public License v3.0 5 votes vote down vote up
@Test
public void testTransactionHash() {
    EqualsVerifier.forClass(EthBlock.TransactionHash.class)
            .suppress(Warning.NONFINAL_FIELDS)
            .suppress(Warning.STRICT_INHERITANCE)
            .verify();
}
 
Example #24
Source File: EqualsVerifierResponseTest.java    From etherscan-explorer with GNU General Public License v3.0 5 votes vote down vote up
@Test
public void testCode() {
    EqualsVerifier.forClass(EthCompileSolidity.Code.class)
            .suppress(Warning.NONFINAL_FIELDS)
            .suppress(Warning.STRICT_INHERITANCE)
            .verify();
}
 
Example #25
Source File: ModifiableUserPropertiesImplTest.java    From hivemq-community-edition with Apache License 2.0 5 votes vote down vote up
@Test
public void equals() {
    EqualsVerifier.forClass(ModifiableUserPropertiesImpl.class)
            .withIgnoredAnnotations(NotNull.class) // EqualsVerifier thinks @NotNull Optional is @NotNull
            .withNonnullFields("list")
            .withIgnoredFields("readWriteLock", "validateUTF8", "modified")
            .suppress(Warning.STRICT_INHERITANCE, Warning.NONFINAL_FIELDS)
            .verify();
}
 
Example #26
Source File: EqualsVerifierResponseTest.java    From etherscan-explorer with GNU General Public License v3.0 5 votes vote down vote up
@Test
public void testAbiDefinitionNamedType() {
    EqualsVerifier.forClass(AbiDefinition.NamedType.class)
            .suppress(Warning.NONFINAL_FIELDS)
            .suppress(Warning.STRICT_INHERITANCE)
            .verify();
}
 
Example #27
Source File: EqualsVerifierResponseTest.java    From etherscan-explorer with GNU General Public License v3.0 5 votes vote down vote up
@Test
public void testAbiDefinition() {
    EqualsVerifier.forClass(AbiDefinition.class)
            .suppress(Warning.NONFINAL_FIELDS)
            .suppress(Warning.STRICT_INHERITANCE)
            .verify();
}
 
Example #28
Source File: EqualsVerifierResponseTest.java    From etherscan-explorer with GNU General Public License v3.0 5 votes vote down vote up
@Test
public void testSyncing() {
    EqualsVerifier.forClass(EthSyncing.Syncing.class)
            .suppress(Warning.NONFINAL_FIELDS)
            .suppress(Warning.STRICT_INHERITANCE)
            .verify();
}
 
Example #29
Source File: BlockTest.java    From exonum-java-binding with Apache License 2.0 5 votes vote down vote up
@Test
void verifyEquals() {
  EqualsVerifier.forClass(AutoValue_Block.class)
      // Constructor ensures that we have no nulls
      .suppress(Warning.NULL_FIELDS)
      // We use 4 bytes from proper SHA-256 with good distribution
      .suppress(Warning.STRICT_HASHCODE)
      .withPrefabValues(HashCode.class, HashCode.fromInt(1), HashCode.fromInt(2))
      .verify();
}
 
Example #30
Source File: EqualsVerifierResponseTest.java    From etherscan-explorer with GNU General Public License v3.0 5 votes vote down vote up
@Test
public void testSshMessage() {
    EqualsVerifier.forClass(ShhMessages.SshMessage.class)
            .suppress(Warning.NONFINAL_FIELDS)
            .suppress(Warning.STRICT_INHERITANCE)
            .verify();
}