WIP: add advanced scenario-tests for coop-assets #123
@ -50,11 +50,10 @@ public class HsOfficeCoopAssetsTransactionEntity implements Stringifyable, BaseE
|
|||||||
.withProp(HsOfficeCoopAssetsTransactionEntity::getAssetValue)
|
.withProp(HsOfficeCoopAssetsTransactionEntity::getAssetValue)
|
||||||
.withProp(HsOfficeCoopAssetsTransactionEntity::getReference)
|
.withProp(HsOfficeCoopAssetsTransactionEntity::getReference)
|
||||||
.withProp(HsOfficeCoopAssetsTransactionEntity::getComment)
|
.withProp(HsOfficeCoopAssetsTransactionEntity::getComment)
|
||||||
// FIXME: try short form with just method reference
|
.withProp(HsOfficeCoopAssetsTransactionEntity::getRevertedAssetTx)
|
||||||
.withProp(at -> ofNullable(at.getRevertedAssetTx()).map(HsOfficeCoopAssetsTransactionEntity::toShortString).orElse(null))
|
.withProp(HsOfficeCoopAssetsTransactionEntity::getAssetReversalTx)
|
||||||
.withProp(at -> ofNullable(at.getAssetReversalTx()).map(HsOfficeCoopAssetsTransactionEntity::toShortString).orElse(null))
|
.withProp(HsOfficeCoopAssetsTransactionEntity::getAssetAdoptionAssetTx)
|
||||||
.withProp(at -> ofNullable(at.getAssetAdoptionAssetTx()).map(HsOfficeCoopAssetsTransactionEntity::toShortString).orElse(null))
|
.withProp(HsOfficeCoopAssetsTransactionEntity::getAssetTransferTx)
|
||||||
.withProp(at -> ofNullable(at.getAssetTransferTx()).map(HsOfficeCoopAssetsTransactionEntity::toShortString).orElse(null))
|
|
||||||
.quotedValues(false);
|
.quotedValues(false);
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
|
@ -80,12 +80,6 @@ public final class Stringify<B> {
|
|||||||
.map(prop -> PropertyValue.of(prop, prop.getter.apply(object)))
|
.map(prop -> PropertyValue.of(prop, prop.getter.apply(object)))
|
||||||
.filter(Objects::nonNull)
|
.filter(Objects::nonNull)
|
||||||
.filter(PropertyValue::nonEmpty)
|
.filter(PropertyValue::nonEmpty)
|
||||||
.map(propVal -> {
|
|
||||||
if (propVal.rawValue instanceof Stringifyable stringifyable) {
|
|
||||||
return new PropertyValue<>(propVal.prop, propVal.rawValue, stringifyable.toShortString());
|
|
||||||
}
|
|
||||||
return propVal;
|
|
||||||
})
|
|
||||||
.map(propVal -> propName(propVal, "=") + optionallyQuoted(propVal))
|
.map(propVal -> propName(propVal, "=") + optionallyQuoted(propVal))
|
||||||
.collect(Collectors.joining(separator));
|
.collect(Collectors.joining(separator));
|
||||||
return idProp != null
|
return idProp != null
|
||||||
@ -131,7 +125,11 @@ public final class Stringify<B> {
|
|||||||
private record PropertyValue<B>(Property<B> prop, Object rawValue, String value) {
|
private record PropertyValue<B>(Property<B> prop, Object rawValue, String value) {
|
||||||
|
|
||||||
static <B> PropertyValue<B> of(Property<B> prop, Object rawValue) {
|
static <B> PropertyValue<B> of(Property<B> prop, Object rawValue) {
|
||||||
return rawValue != null ? new PropertyValue<>(prop, rawValue, rawValue.toString()) : null;
|
return rawValue != null ? new PropertyValue<>(prop, rawValue, toStringOrShortString(rawValue)) : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String toStringOrShortString(final Object rawValue) {
|
||||||
|
return rawValue instanceof Stringifyable stringifyable ? stringifyable.toShortString() : rawValue.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean nonEmpty() {
|
boolean nonEmpty() {
|
||||||
|
Loading…
Reference in New Issue
Block a user