use of de.metas.material.event.commons.AttributesKey in project metasfresh-webui-api by metasfresh.
the class AvailableToPromiseAdapterTests method extractType_attributeSet.
@Test
public void extractType_attributeSet() {
final AttributesKey attributesKey = AttributesKey.ofAttributeValueIds(12345);
final Group.Type type = availableToPromiseAdapter.extractType(attributesKey);
assertThat(type).isSameAs(Type.ATTRIBUTE_SET);
}
use of de.metas.material.event.commons.AttributesKey in project metasfresh-webui-api by metasfresh.
the class AvailableToPromiseAdapterTests method extractAttributeSetFromStorageAttributesKey.
@Test
public void extractAttributeSetFromStorageAttributesKey() {
final I_M_Attribute attr1 = attributesTestHelper.createM_Attribute("attr1", X_M_Attribute.ATTRIBUTEVALUETYPE_List, true);
final I_M_AttributeValue attributeValue1 = attributesTestHelper.createM_AttributeValue(attr1, "value1");
final I_M_Attribute attr2 = attributesTestHelper.createM_Attribute("attr2", X_M_Attribute.ATTRIBUTEVALUETYPE_List, true);
final I_M_AttributeValue attributeValue2 = attributesTestHelper.createM_AttributeValue(attr2, "value2");
// invoke the method under test
final AttributesKey attributesKey = AttributesKey.ofAttributeValueIds(attributeValue1.getM_AttributeValue_ID(), attributeValue2.getM_AttributeValue_ID());
final List<I_M_AttributeValue> result = availableToPromiseAdapter.extractAttributeSetFromStorageAttributesKey(attributesKey);
assertThat(result).hasSize(2);
assertThat(result).anySatisfy(attributeValue -> {
assertThatModel(attributeValue).hasSameIdAs(attributeValue1);
assertThat(attributeValue.getValue()).isEqualTo("value1");
});
assertThat(result).anySatisfy(attributeValue -> {
assertThatModel(attributeValue).hasSameIdAs(attributeValue2);
assertThat(attributeValue.getValue()).isEqualTo("value2");
});
}
Aggregations