nl.jqno.equalsverifier.EqualsVerifier Java Examples

The following examples show how to use nl.jqno.equalsverifier.EqualsVerifier. 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: CassandraTableTest.java    From james-project with Apache License 2.0 5 votes vote down vote up
@Test
void shouldRespectBeanContract() {
    EqualsVerifier.forClass(CassandraTable.class)
        .withPrefabValues(
            Statement.class,
            QueryBuilder.select("foo").from("foo"),
            QueryBuilder.select("bar").from("bar"))
        .verify();
}
 
Example #2
Source File: HeaderValueParamTest.java    From holdmail with Apache License 2.0 5 votes vote down vote up
@Test
public void shouldHaveValidEqualsHashcode() {

    EqualsVerifier.forClass(HeaderValueParam.class)
            .suppress(Warning.STRICT_INHERITANCE)
            .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 testStateDiff() {
    EqualsVerifier.forClass(StateDiff.class)
            .suppress(Warning.NONFINAL_FIELDS)
            .suppress(Warning.STRICT_INHERITANCE)
            .verify();
}
 
Example #4
Source File: RetrieveHealthResponseTest.java    From ditto with Eclipse Public License 2.0 5 votes vote down vote up
@Test
public void testHashCodeAndEquals() {
    EqualsVerifier.forClass(RetrieveHealthResponse.class)
            .usingGetClass()
            .withPrefabValues(StatusInfo.class, StatusInfo.fromStatus(StatusInfo.Status.UP, "up"),
                    StatusInfo.fromStatus(StatusInfo.Status.DOWN, "down"))
            .verify();
}
 
Example #5
Source File: ImmutableDefinitionIdentifierTest.java    From ditto with Eclipse Public License 2.0 5 votes vote down vote up
@Test
public void testHashCodeAndEquals() {
    EqualsVerifier.forClass(ImmutableDefinitionIdentifier.class)
            .usingGetClass()
            .withIgnoredFields("stringRepresentation") // as it is only derived from other properties
            .verify();
}
 
Example #6
Source File: QueryTest.java    From spectator with Apache License 2.0 5 votes vote down vote up
@Test
public void hasEqualsContract() {
  EqualsVerifier
      .forClass(Query.Has.class)
      .suppress(Warning.NULL_FIELDS)
      .verify();
}
 
Example #7
Source File: ImmutableFeatureTest.java    From ditto with Eclipse Public License 2.0 5 votes vote down vote up
@Test
public void testHashCodeAndEquals() {
    final SoftReference<JsonObject> red = new SoftReference<>(JsonFactory.newObject("{\"foo\": 1}"));
    final SoftReference<JsonObject> black = new SoftReference<>(JsonFactory.newObject("{\"foo\": 2}"));

    EqualsVerifier.forClass(ImmutableFeature.class)
            .withPrefabValues(SoftReference.class, red, black)
            .verify();
}
 
Example #8
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 #9
Source File: EqualsVerifierParityResponseTest.java    From web3j with Apache License 2.0 5 votes vote down vote up
@Test
public void testFullTraceInfo() {
    VMTrace vmTrace1 = new VMTrace("one", new ArrayList<>());
    VMTrace vmTrace2 = new VMTrace("two", new ArrayList<>());

    EqualsVerifier.forClass(FullTraceInfo.class)
            .withPrefabValues(VMTrace.class, vmTrace1, vmTrace2)
            .suppress(Warning.NONFINAL_FIELDS)
            .suppress(Warning.STRICT_INHERITANCE)
            .verify();
}
 
Example #10
Source File: GameDataExporterTest.java    From triplea with GNU General Public License v3.0 5 votes vote down vote up
@Test
void shouldBeEquatableAndHashable() {
  final GameData gameData = new GameData();
  EqualsVerifier.forClass(GameDataExporter.Connection.class)
      .withPrefabValues(
          Territory.class,
          new Territory("redTerritory", gameData),
          new Territory("blackTerritory", gameData))
      .verify();
}
 
Example #11
Source File: DataExprTest.java    From spectator with Apache License 2.0 5 votes vote down vote up
@Test
public void dropEqualsContract() {
  EqualsVerifier
      .forClass(DataExpr.DropRollup.class)
      .suppress(Warning.NULL_FIELDS)
      .verify();
}
 
Example #12
Source File: ReferenceSchemaTest.java    From json-schema with Apache License 2.0 5 votes vote down vote up
@Test
public void equalsVerifier() {
    EqualsVerifier.forClass(ReferenceSchema.class)
            .withRedefinedSuperclass()
            .withIgnoredFields("schemaLocation", "location")
            //there are specifically some non final fields for loading of recursive schemas
            .suppress(Warning.NONFINAL_FIELDS)
            .suppress(Warning.STRICT_INHERITANCE)
            .verify();
}
 
Example #13
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 #14
Source File: EffectedResourcesTest.java    From ditto with Eclipse Public License 2.0 5 votes vote down vote up
/** */
@Test
public void testHashCodeAndEquals() {
    EqualsVerifier.forClass(EffectedResources.class) //
            .withRedefinedSuperclass() //
            .verify();
}
 
Example #15
Source File: EqualsVerifierResponseTest.java    From client-sdk-java with Apache License 2.0 5 votes vote down vote up
@Test
public void testBlock() {
    EqualsVerifier.forClass(PlatonBlock.Block.class)
            .suppress(Warning.NONFINAL_FIELDS)
            .suppress(Warning.STRICT_INHERITANCE)
            .verify();
}
 
Example #16
Source File: UpdateServiceInstanceRequestTest.java    From spring-cloud-open-service-broker with Apache License 2.0 5 votes vote down vote up
@Test
public void equalsAndHashCode() {
	EqualsVerifier
			.forClass(UpdateServiceInstanceRequest.class)
			.withRedefinedSuperclass()
			.suppress(Warning.NONFINAL_FIELDS)
			.suppress(Warning.TRANSIENT_FIELDS)
			.verify();
}
 
Example #17
Source File: EqualsVerifierResponseTest.java    From client-sdk-java with Apache License 2.0 5 votes vote down vote up
@Test
public void testTransactionReceipt() {
    EqualsVerifier.forClass(TransactionReceipt.class)
            .suppress(Warning.NONFINAL_FIELDS)
            .suppress(Warning.STRICT_INHERITANCE)
            .verify();
}
 
Example #18
Source File: EmbeddedConfigurationTest.java    From junit-servers with MIT License 5 votes vote down vote up
@Test
void it_should_implement_equals_hashCode() {
	final ClassLoader red = new URLClassLoader(new URL[0]);
	final ClassLoader black = new URLClassLoader(new URL[0]);
	EqualsVerifier.forClass(EmbeddedConfiguration.class)
		.withPrefabValues(ClassLoader.class, red, black)
		.verify();
}
 
Example #19
Source File: RetrieveAttributesLiveCommandImplTest.java    From ditto with Eclipse Public License 2.0 5 votes vote down vote up
/** */
@Test
public void testHashCodeAndEquals() {
    EqualsVerifier.forClass(RetrieveAttributesLiveCommandImpl.class)
            .withRedefinedSuperclass()
            .withIgnoredFields("thingQueryCommand")
            .verify();
}
 
Example #20
Source File: EqualsVerifierParityResponseTest.java    From web3j with Apache License 2.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: UpdateThingTest.java    From ditto with Eclipse Public License 2.0 5 votes vote down vote up
@Test
public void testHashCodeAndEquals() {
    EqualsVerifier.forClass(UpdateThing.class)
            .usingGetClass()
            .withRedefinedSuperclass()
            .verify();
}
 
Example #22
Source File: EqualsVerifierResponseTest.java    From client-sdk-java with Apache License 2.0 5 votes vote down vote up
@Test
public void testError() {
    EqualsVerifier.forClass(Response.Error.class)
            .suppress(Warning.NONFINAL_FIELDS)
            .suppress(Warning.STRICT_INHERITANCE)
            .verify();
}
 
Example #23
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 #24
Source File: EqualsVerifierResponseTest.java    From etherscan-explorer with GNU General Public License v3.0 5 votes vote down vote up
@Test
public void testTransaction() {
    EqualsVerifier.forClass(Transaction.class)
            .suppress(Warning.NONFINAL_FIELDS)
            .suppress(Warning.STRICT_INHERITANCE)
            .verify();
}
 
Example #25
Source File: RequestQuickLoadTest.java    From ocraft-s2client with MIT License 5 votes vote down vote up
@Test
void fulfillsEqualsContract() {
    EqualsVerifier.forClass(RequestQuickLoad.class)
            .withIgnoredFields("nanoTime")
            .withRedefinedSuperclass()
            .verify();
}
 
Example #26
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 #27
Source File: MutationStatusTestPairTest.java    From pitest with Apache License 2.0 4 votes vote down vote up
@Test
public void shouldObeyHashcodeEqualsContract() {
  EqualsVerifier.forClass(MutationStatusTestPair.class).verify();
}
 
Example #28
Source File: CassandraConfigurationTest.java    From james-project with Apache License 2.0 4 votes vote down vote up
@Test
void cassandraConfigurationShouldRespectBeanContract() {
    EqualsVerifier.forClass(CassandraConfiguration.class)
        .verify();
}
 
Example #29
Source File: PojoTestBase.java    From spring-batch-lightmin with Apache License 2.0 4 votes vote down vote up
protected void testEquals(final Class<?> clazz) {
    EqualsVerifier
            .forClass(clazz)
            .suppress(Warning.STRICT_INHERITANCE, Warning.NONFINAL_FIELDS, Warning.REFERENCE_EQUALITY)
            .verify();
}
 
Example #30
Source File: PersonTest.java    From jpx with Apache License 2.0 4 votes vote down vote up
@Test
public void equalsVerifier() {
	EqualsVerifier.forClass(Person.class).verify();
}