### Question:
IsRisingRule extends AbstractRule { @Override public boolean isSatisfied(int index, TradingRecord tradingRecord) { if (minStrenght >= 1) { minStrenght = 0.99; } int count = 0; for (int i = Math.max(0, index - barCount + 1); i <= index; i++) { if (ref.getValue(i).isGreaterThan(ref.getValue(Math.max(0, i - 1)))) { count += 1; } } double ratio = count / (double) barCount; final boolean satisfied = ratio >= minStrenght; traceIsSatisfied(index, satisfied); return satisfied; } IsRisingRule(Indicator<Num> ref, int barCount);  IsRisingRule(Indicator<Num> ref, int barCount, double minStrenght); @Override boolean isSatisfied(int index, TradingRecord tradingRecord);  }### Answer:
@Test public void isSatisfied() { assertFalse(rule.isSatisfied(0)); assertFalse(rule.isSatisfied(1)); assertFalse(rule.isSatisfied(2)); assertTrue(rule.isSatisfied(3)); assertTrue(rule.isSatisfied(4)); assertTrue(rule.isSatisfied(5)); assertFalse(rule.isSatisfied(6)); assertFalse(rule.isSatisfied(7)); assertFalse(rule.isSatisfied(8)); assertTrue(rule.isSatisfied(9)); }