### Question:
DefaultRiskAnalysis implements RiskAnalysis { @Override public Result analyze() { checkState(!analyzed); analyzed = true; Result result = analyzeIsFinal(); if (result != Result.OK) return result; return analyzeIsStandard(); } private  DefaultRiskAnalysis(Wallet wallet, Transaction tx, List<Transaction> dependencies); @Override Result analyze(); static RuleViolation isStandard(Transaction tx); @Nullable Transaction getNonStandard(); @Nullable Transaction getNonFinal(); @Override String toString(); static Analyzer FACTORY; }### Answer:
@Test public void selfCreatedAreNotRisky() { Transaction tx = new Transaction(params); tx.addInput(params.getGenesisBlock().getTransactions().get(0).getOutput(0)).setSequenceNumber(1); tx.addOutput(Utils.COIN, key1); tx.setLockTime(TIMESTAMP + 86400); { DefaultRiskAnalysis analysis = DefaultRiskAnalysis.FACTORY.create(wallet, tx, NO_DEPS); assertEquals(RiskAnalysis.Result.NON_FINAL, analysis.analyze()); } tx.getConfidence().setSource(TransactionConfidence.Source.SELF); { DefaultRiskAnalysis analysis = DefaultRiskAnalysis.FACTORY.create(wallet, tx, NO_DEPS); assertEquals(RiskAnalysis.Result.OK, analysis.analyze()); } }
@Test public void nonStandardDust() { Transaction standardTx = new Transaction(params); standardTx.addInput(params.getGenesisBlock().getTransactions().get(0).getOutput(0)); standardTx.addOutput(Utils.COIN, key1); assertEquals(RiskAnalysis.Result.OK, DefaultRiskAnalysis.FACTORY.create(wallet, standardTx, NO_DEPS).analyze()); Transaction dustTx = new Transaction(params); dustTx.addInput(params.getGenesisBlock().getTransactions().get(0).getOutput(0)); dustTx.addOutput(BigInteger.ONE, key1); assertEquals(RiskAnalysis.Result.NON_STANDARD, DefaultRiskAnalysis.FACTORY.create(wallet, dustTx, NO_DEPS).analyze()); Transaction edgeCaseTx = new Transaction(params); edgeCaseTx.addInput(params.getGenesisBlock().getTransactions().get(0).getOutput(0)); edgeCaseTx.addOutput(dustTx.getOutput(0).getMinNonDustValue(), key1); assertEquals(RiskAnalysis.Result.OK, DefaultRiskAnalysis.FACTORY.create(wallet, edgeCaseTx, NO_DEPS).analyze()); }