Java Code Examples for nl.jqno.equalsverifier.EqualsVerifier

The following examples show how to use nl.jqno.equalsverifier.EqualsVerifier. These examples are extracted from open source projects. 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 Project: spectator   Source File: DataExprTest.java    License: 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 2
Source Project: web3j   Source File: EqualsVerifierParityResponseTest.java    License: 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 3
@Test
public void testHashCodeAndEquals() {
    EqualsVerifier.forClass(ImmutableDefinitionIdentifier.class)
            .usingGetClass()
            .withIgnoredFields("stringRepresentation") // as it is only derived from other properties
            .verify();
}
 
Example 4
Source Project: json-schema   Source File: ReferenceSchemaTest.java    License: 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 5
Source Project: ditto   Source File: RetrieveHealthResponseTest.java    License: 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 6
Source Project: spectator   Source File: QueryTest.java    License: 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 Project: triplea   Source File: GameDataExporterTest.java    License: 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 8
Source Project: james-project   Source File: CassandraTableTest.java    License: 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 9
@Test
public void testBlock() {
    EqualsVerifier.forClass(PlatonBlock.Block.class)
            .suppress(Warning.NONFINAL_FIELDS)
            .suppress(Warning.STRICT_INHERITANCE)
            .verify();
}
 
Example 10
@Test
public void equalsAndHashCode() {
	EqualsVerifier
			.forClass(UpdateServiceInstanceRequest.class)
			.withRedefinedSuperclass()
			.suppress(Warning.NONFINAL_FIELDS)
			.suppress(Warning.TRANSIENT_FIELDS)
			.verify();
}
 
Example 11
@Test
public void testTransactionReceipt() {
    EqualsVerifier.forClass(TransactionReceipt.class)
            .suppress(Warning.NONFINAL_FIELDS)
            .suppress(Warning.STRICT_INHERITANCE)
            .verify();
}
 
Example 12
Source Project: web3j   Source File: EqualsVerifierParityResponseTest.java    License: 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 13
@Test
public void testError() {
    EqualsVerifier.forClass(Response.Error.class)
            .suppress(Warning.NONFINAL_FIELDS)
            .suppress(Warning.STRICT_INHERITANCE)
            .verify();
}
 
Example 14
@Test
public void testTransaction() {
    EqualsVerifier.forClass(Transaction.class)
            .suppress(Warning.NONFINAL_FIELDS)
            .suppress(Warning.STRICT_INHERITANCE)
            .verify();
}
 
Example 15
Source Project: ocraft-s2client   Source File: RequestQuickLoadTest.java    License: MIT License 5 votes vote down vote up
@Test
void fulfillsEqualsContract() {
    EqualsVerifier.forClass(RequestQuickLoad.class)
            .withIgnoredFields("nanoTime")
            .withRedefinedSuperclass()
            .verify();
}
 
Example 16
Source Project: ditto   Source File: UpdateThingTest.java    License: Eclipse Public License 2.0 5 votes vote down vote up
@Test
public void testHashCodeAndEquals() {
    EqualsVerifier.forClass(UpdateThing.class)
            .usingGetClass()
            .withRedefinedSuperclass()
            .verify();
}
 
Example 17
Source Project: junit-servers   Source File: EmbeddedConfigurationTest.java    License: 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 18
Source Project: ditto   Source File: EffectedResourcesTest.java    License: Eclipse Public License 2.0 5 votes vote down vote up
/** */
@Test
public void testHashCodeAndEquals() {
    EqualsVerifier.forClass(EffectedResources.class) //
            .withRedefinedSuperclass() //
            .verify();
}
 
Example 19
Source Project: ditto   Source File: ImmutableFeatureTest.java    License: 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 20
@Test
public void testStateDiff() {
    EqualsVerifier.forClass(StateDiff.class)
            .suppress(Warning.NONFINAL_FIELDS)
            .suppress(Warning.STRICT_INHERITANCE)
            .verify();
}
 
Example 21
/**
 * Test hash code and equals.
 */
@Test
public void testHashCodeAndEquals() {
    EqualsVerifier.forClass(ImmutableTopicPathPlaceholder.class)
            .suppress(Warning.INHERITED_DIRECTLY_FROM_OBJECT)
            .usingGetClass()
            .verify();
}
 
Example 22
@Test
public void testAddedState() {
    EqualsVerifier.forClass(StateDiff.AddedState.class)
            .suppress(Warning.NONFINAL_FIELDS)
            .suppress(Warning.STRICT_INHERITANCE)
            .verify();
}
 
Example 23
@Test
public void testTraceCreateAction() {
    EqualsVerifier.forClass(Trace.CreateAction.class)
            .suppress(Warning.NONFINAL_FIELDS)
            .suppress(Warning.STRICT_INHERITANCE)
            .verify();
}
 
Example 24
@Test
public void testTraceResult() {
    EqualsVerifier.forClass(Trace.Result.class)
            .suppress(Warning.NONFINAL_FIELDS)
            .suppress(Warning.STRICT_INHERITANCE)
            .verify();
}
 
Example 25
/** */
@Test
public void testHashCodeAndEquals() {
    EqualsVerifier.forClass(RetrieveAttributesLiveCommandImpl.class)
            .withRedefinedSuperclass()
            .withIgnoredFields("thingQueryCommand")
            .verify();
}
 
Example 26
Source Project: holdmail   Source File: HeaderValueParamTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void shouldHaveValidEqualsHashcode() {

    EqualsVerifier.forClass(HeaderValueParam.class)
            .suppress(Warning.STRICT_INHERITANCE)
            .verify();

}
 
Example 27
Source Project: spectator   Source File: MatcherEqualsTest.java    License: Apache License 2.0 4 votes vote down vote up
@Test
public void or() {
  EqualsVerifier.forClass(OrMatcher.class).verify();
}
 
Example 28
Source Project: ditto   Source File: DeleteThingResponseTest.java    License: Eclipse Public License 2.0 4 votes vote down vote up
@Test
public void testHashCodeAndEquals() {
    EqualsVerifier.forClass(DeleteThingResponse.class)
            .withRedefinedSuperclass()
            .verify();
}
 
Example 29
@Test
public void testHashCodeAndEquals() {
    EqualsVerifier.forClass(DefaultThingsAggregatorConfig.class)
            .usingGetClass()
            .verify();
}
 
Example 30
Source Project: james-project   Source File: DomainIdTest.java    License: Apache License 2.0 4 votes vote down vote up
@Test
void domainIdShouldRespectBeanContract() {
    EqualsVerifier.forClass(DomainId.class).verify();
}