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