@Test public void toStringMethod() { AbstractAnalysisCriterion c1 = new AverageProfitCriterion(); assertEquals("Average Profit", c1.toString()); AbstractAnalysisCriterion c2 = new BuyAndHoldCriterion(); assertEquals("Buy And Hold", c2.toString()); AbstractAnalysisCriterion c3 = new RewardRiskRatioCriterion(); assertEquals("Reward Risk Ratio", c3.toString()); }
@Override public String toString() { String[] tokens = getClass().getSimpleName().split("(?=\\p{Lu})", -1); StringBuilder sb = new StringBuilder(); for (int i = 0; i < tokens.length - 1; i++) { sb.append(tokens[i]).append(' '); } return sb.toString().trim(); }
AbstractAnalysisCriterion implements AnalysisCriterion { @Override public String toString() { String[] tokens = getClass().getSimpleName().split("(?=\\p{Lu})", -1); StringBuilder sb = new StringBuilder(); for (int i = 0; i < tokens.length - 1; i++) { sb.append(tokens[i]).append(' '); } return sb.toString().trim(); } }
AbstractAnalysisCriterion implements AnalysisCriterion { @Override public String toString() { String[] tokens = getClass().getSimpleName().split("(?=\\p{Lu})", -1); StringBuilder sb = new StringBuilder(); for (int i = 0; i < tokens.length - 1; i++) { sb.append(tokens[i]).append(' '); } return sb.toString().trim(); }  }
AbstractAnalysisCriterion implements AnalysisCriterion { @Override public String toString() { String[] tokens = getClass().getSimpleName().split("(?=\\p{Lu})", -1); StringBuilder sb = new StringBuilder(); for (int i = 0; i < tokens.length - 1; i++) { sb.append(tokens[i]).append(' '); } return sb.toString().trim(); }  @Override String toString(); }
AbstractAnalysisCriterion implements AnalysisCriterion { @Override public String toString() { String[] tokens = getClass().getSimpleName().split("(?=\\p{Lu})", -1); StringBuilder sb = new StringBuilder(); for (int i = 0; i < tokens.length - 1; i++) { sb.append(tokens[i]).append(' '); } return sb.toString().trim(); }  @Override String toString();  }