Search in sources :

Example 6 with Some

use of org.qi4j.runtime.property.PropertyEqualityTest.Some in project qi4j-sdk by Qi4j.

the class ValueEqualityTest method givenValuesOfSameTypesAndDifferentStateWhenTestingValueStateEqualityExpectNotEquals.

@Test
public void givenValuesOfSameTypesAndDifferentStateWhenTestingValueStateEqualityExpectNotEquals() {
    Some some = buildSomeValue(module);
    AssociationStateHolder someState = qi4j.spi().stateOf((ValueComposite) some);
    Some some2 = buildSomeValueWithDifferentState(module);
    AssociationStateHolder some2State = qi4j.spi().stateOf((ValueComposite) some2);
    assertThat("ValueStates not equal", someState, not(equalTo(some2State)));
    assertThat("ValueStates hashcode not equal", someState.hashCode(), not(equalTo(some2State.hashCode())));
}
Also used : AnotherSome(org.qi4j.runtime.property.PropertyEqualityTest.AnotherSome) Some(org.qi4j.runtime.property.PropertyEqualityTest.Some) AssociationStateHolder(org.qi4j.api.association.AssociationStateHolder) AbstractQi4jTest(org.qi4j.test.AbstractQi4jTest) Test(org.junit.Test)

Example 7 with Some

use of org.qi4j.runtime.property.PropertyEqualityTest.Some in project qi4j-sdk by Qi4j.

the class ValueEqualityTest method givenValuesOfSameTypesAndSameStateWhenTestingValueEqualityExpectEquals.

//
// ------------------------------------:: Value equality tests ::---------------------------------------------------
//
@Test
public void givenValuesOfSameTypesAndSameStateWhenTestingValueEqualityExpectEquals() {
    Some some = buildSomeValue(module);
    Some some2 = buildSomeValue(module);
    assertThat("Values equal", some, equalTo(some2));
    assertThat("Values hashcode equal", some.hashCode(), equalTo(some2.hashCode()));
}
Also used : AnotherSome(org.qi4j.runtime.property.PropertyEqualityTest.AnotherSome) Some(org.qi4j.runtime.property.PropertyEqualityTest.Some) AbstractQi4jTest(org.qi4j.test.AbstractQi4jTest) Test(org.junit.Test)

Example 8 with Some

use of org.qi4j.runtime.property.PropertyEqualityTest.Some in project qi4j-sdk by Qi4j.

the class ValueEqualityTest method givenValuesOfTheSameTypeWhenTestingValueDescriptorEqualityExpectEquals.

//
// -------------------------------:: ValueDescriptor equality tests ::----------------------------------------------
//
@Test
public void givenValuesOfTheSameTypeWhenTestingValueDescriptorEqualityExpectEquals() {
    Some some = buildSomeValue(module);
    ValueDescriptor someDescriptor = qi4j.api().valueDescriptorFor(some);
    Some other = buildSomeValue(module);
    ValueDescriptor otherDescriptor = qi4j.api().valueDescriptorFor(other);
    assertThat("ValueDescriptors equal", someDescriptor, equalTo(otherDescriptor));
    assertThat("ValueDescriptors hashcode equal", someDescriptor.hashCode(), equalTo(otherDescriptor.hashCode()));
}
Also used : AnotherSome(org.qi4j.runtime.property.PropertyEqualityTest.AnotherSome) Some(org.qi4j.runtime.property.PropertyEqualityTest.Some) ValueDescriptor(org.qi4j.api.value.ValueDescriptor) AbstractQi4jTest(org.qi4j.test.AbstractQi4jTest) Test(org.junit.Test)

Example 9 with Some

use of org.qi4j.runtime.property.PropertyEqualityTest.Some in project qi4j-sdk by Qi4j.

the class ValueEqualityTest method givenValuesOfDifferentTypesAndSameStateWhenTestingValueEqualityExpectNotEquals.

@Test
public void givenValuesOfDifferentTypesAndSameStateWhenTestingValueEqualityExpectNotEquals() {
    Some some = buildSomeValue(module);
    Some anotherSome = buildAnotherSomeValue(module);
    assertThat("Values not equal", some, not(equalTo(anotherSome)));
    assertThat("Values hashcode not equal", some.hashCode(), not(equalTo(anotherSome.hashCode())));
}
Also used : AnotherSome(org.qi4j.runtime.property.PropertyEqualityTest.AnotherSome) Some(org.qi4j.runtime.property.PropertyEqualityTest.Some) AbstractQi4jTest(org.qi4j.test.AbstractQi4jTest) Test(org.junit.Test)

Example 10 with Some

use of org.qi4j.runtime.property.PropertyEqualityTest.Some in project qi4j-sdk by Qi4j.

the class ValueEqualityTest method givenValuesOfSameTypesAndSameStateWhenTestingValueStateEqualityExpectEquals.

//
// ---------------------------------:: Value State equality tests ::------------------------------------------------
//
@Test
public void givenValuesOfSameTypesAndSameStateWhenTestingValueStateEqualityExpectEquals() {
    Some some = buildSomeValue(module);
    AssociationStateHolder someState = qi4j.spi().stateOf((ValueComposite) some);
    Some some2 = buildSomeValue(module);
    AssociationStateHolder some2State = qi4j.spi().stateOf((ValueComposite) some2);
    assertThat("ValueStates equal", someState, equalTo(some2State));
    assertThat("ValueStates hashcode equal", someState.hashCode(), equalTo(some2State.hashCode()));
}
Also used : AnotherSome(org.qi4j.runtime.property.PropertyEqualityTest.AnotherSome) Some(org.qi4j.runtime.property.PropertyEqualityTest.Some) AssociationStateHolder(org.qi4j.api.association.AssociationStateHolder) AbstractQi4jTest(org.qi4j.test.AbstractQi4jTest) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)11 AnotherSome (org.qi4j.runtime.property.PropertyEqualityTest.AnotherSome)11 Some (org.qi4j.runtime.property.PropertyEqualityTest.Some)11 AbstractQi4jTest (org.qi4j.test.AbstractQi4jTest)11 AssociationStateHolder (org.qi4j.api.association.AssociationStateHolder)4 ValueDescriptor (org.qi4j.api.value.ValueDescriptor)3 Other (org.qi4j.runtime.property.PropertyEqualityTest.Other)1 PrimitivesValue (org.qi4j.runtime.property.PropertyEqualityTest.PrimitivesValue)1 PropertyEqualityTest.buildPrimitivesValue (org.qi4j.runtime.property.PropertyEqualityTest.buildPrimitivesValue)1