### Question:
TransactionOutput extends ChildMessage { public Coin getMinNonDustValue(Coin feePerKb) { long size = this.unsafeBitcoinSerialize().length; final Script script = getScriptPubKey(); if (ScriptPattern.isP2PKH(script) || ScriptPattern.isP2PK(script) || ScriptPattern.isP2SH(script)) size += 32 + 4 + 1 + 107 + 4; else if (ScriptPattern.isP2WH(script)) size += 32 + 4 + 1 + (107 / 4) + 4; else return Coin.ZERO; return feePerKb.multiply(size).divide(1000); } TransactionOutput(NetworkParameters params, @Nullable Transaction parent, byte[] payload,
                             int offset);  TransactionOutput(NetworkParameters params, @Nullable Transaction parent, byte[] payload, int offset, MessageSerializer serializer);  TransactionOutput(NetworkParameters params, @Nullable Transaction parent, Coin value, Address to);  TransactionOutput(NetworkParameters params, @Nullable Transaction parent, Coin value, ECKey to);  TransactionOutput(NetworkParameters params, @Nullable Transaction parent, Coin value, byte[] scriptBytes); Script getScriptPubKey(); @Nullable @Deprecated LegacyAddress getAddressFromP2PKHScript(NetworkParameters params); @Nullable @Deprecated LegacyAddress getAddressFromP2SH(NetworkParameters params); Coin getValue(); void setValue(Coin value); int getIndex(); boolean isDust(); Coin getMinNonDustValue(Coin feePerKb); Coin getMinNonDustValue(); void markAsSpent(TransactionInput input); void markAsUnspent(); boolean isAvailableForSpending(); byte[] getScriptBytes(); boolean isMineOrWatched(TransactionBag transactionBag); boolean isWatched(TransactionBag transactionBag); boolean isMine(TransactionBag transactionBag); @Override String toString(); @Nullable TransactionInput getSpentBy(); @Nullable Transaction getParentTransaction(); @Nullable Sha256Hash getParentTransactionHash(); int getParentTransactionDepthInBlocks(); TransactionOutPoint getOutPointFor(); TransactionOutput duplicateDetached(); @Override boolean equals(Object o); @Override int hashCode();  }### Answer:
@Test public void getMinNonDustValue() throws Exception { TransactionOutput p2pk = new TransactionOutput(UNITTEST, null, Coin.COIN, myKey); assertEquals(Coin.valueOf(576), p2pk.getMinNonDustValue()); TransactionOutput p2pkh = new TransactionOutput(UNITTEST, null, Coin.COIN, LegacyAddress.fromKey(UNITTEST, myKey)); assertEquals(Coin.valueOf(546), p2pkh.getMinNonDustValue()); TransactionOutput p2wpkh = new TransactionOutput(UNITTEST, null, Coin.COIN, SegwitAddress.fromKey(UNITTEST, myKey)); assertEquals(Coin.valueOf(294), p2wpkh.getMinNonDustValue()); }
@Test public void getMinNonDustValue() throws Exception { TransactionOutput p2pk = new TransactionOutput(UNITTEST, null, Coin.COIN, myKey); assertEquals(Coin.valueOf(76800), p2pk.getMinNonDustValue()); TransactionOutput p2pkh = new TransactionOutput(UNITTEST, null, Coin.COIN, LegacyAddress.fromKey(UNITTEST, myKey)); assertEquals(Coin.valueOf(72800), p2pkh.getMinNonDustValue()); TransactionOutput p2wpkh = new TransactionOutput(UNITTEST, null, Coin.COIN, SegwitAddress.fromKey(UNITTEST, myKey)); assertEquals(Coin.valueOf(39200), p2wpkh.getMinNonDustValue()); }