// Path: src/main/java/au/net/woodberry/ta/toolbox/enums/Sentiment.java
// public enum Sentiment {
//     
//     BULLISH, NEUTRAL, BEARISH;
// }
// 
// Path: src/test/java/au/net/woodberry/ta/toolbox/indicators/StubDataTestUtils.java
// public class StubDataTestUtils {
// 
//     private static final String SEPARATOR = ",";
//     private static final String COMMENT_LINE = "#";
//     private static final int TIMESTAMP = 0;
//     private static final int OPEN = 1;
//     private static final int HIGH = 2;
//     private static final int LOW = 3;
//     private static final int CLOSE = 4;
//     private static final int VOLUME = 5;
// 
//     private StubDataTestUtils() {}
// 
//     public static List<Tick> createTickData(String stubData) {
//         return createTickData(stubData, SEPARATOR, null, null);
//     }
//     
//     public static List<Tick> createTickData(String stubData, DateTimeFormatter dtf) {
//         return createTickData(stubData, SEPARATOR, null, dtf);
//     }
// 
//     public static List<Tick> createTickData(String stubData, String separator, Pattern header, DateTimeFormatter dtf) {
//         List<Tick> ticks = new ArrayList<>();
//         BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(StubDataTestUtils.class.getResourceAsStream(stubData)));
//         String line;
//         try {
//             while ((line = bufferedReader.readLine()) != null) {
//                 String[] data = line.split(separator);
//                 if (data == null || (header != null && header.matcher(line).matches()) || line.startsWith(COMMENT_LINE)) { // Headers, comments, no data
//                     continue;
//                 }
//                 DateTime dt = dtf != null ? DateTime.parse(data[TIMESTAMP], dtf) : DateTime.parse(data[TIMESTAMP]);
//                 Tick tick = new Tick(dt, Double.parseDouble(data[OPEN]), Double.parseDouble(data[HIGH]), Double.parseDouble(data[LOW]),
//                         Double.parseDouble(data[CLOSE]), Double.parseDouble(data[VOLUME]));
//                 ticks.add(tick);
//             }
//             bufferedReader.close();
//         } catch (IOException e) {
//             throw new RuntimeException(e);
//         }
//         return ticks;
//     }
// }
// 
// Path: src/main/java/au/net/woodberry/ta/toolbox/object/NR7Breakout.java
// public class NR7Breakout {
//     
//     private final Sentiment sentiment;
//     private final Tick nr7;
//     private final Tick breakout;
// 
//     /**
//      * *
//      * @param nr7 The tick at which the nr7 pattern has formed and the pattern ends
//      * @param breakout The tick at which a breakout is signalled
//      * @param sentiment The sentiment of the breakout
//      */
//     public NR7Breakout(Tick nr7, Tick breakout, Sentiment sentiment) {
//         this.nr7 = nr7;
//         this.breakout = breakout;
//         this.sentiment = sentiment;
//     }
// 
//     public Sentiment getSentiment() {
//         return sentiment;
//     }
// 
//     public Tick getNr7() {
//         return nr7;
//     }
// 
//     public Tick getBreakout() {
//         return breakout;
//     }
// 
//     @Override
//     public String toString() {
//         return "NR7 tick: [Date: " + nr7.getEndTime() + "] " +
//                "Breakout Tick: [Date:" + breakout.getEndTime() + "] " +
//                "Sentiment: " + sentiment;
//     }
// }


import au.net.woodberry.ta.toolbox.enums.Sentiment;
import au.net.woodberry.ta.toolbox.indicators.StubDataTestUtils;
import au.net.woodberry.ta.toolbox.object.NR7Breakout;
import eu.verdelhan.ta4j.Tick;
import eu.verdelhan.ta4j.TimeSeries;
import org.joda.time.DateTime;
import org.junit.Test;
import java.util.Arrays;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
package au.net.woodberry.ta.toolbox.indicators.breakout;




public class NR7BreakoutIndicatorTest {
    
    @Test(expected = IllegalArgumentException.class)
    public void testThrowsExceptionNullTimeSeries() {
        new NR7BreakoutIndicator(null, 0);
    }

    @Test(expected = IllegalArgumentException.class)
    public void testThrowsExceptionTimeSeriesSizeIsTooSmall() {
        new NR7BreakoutIndicator(new TimeSeries(Arrays.asList(new Tick(null, null))), 0);
    }

    @Test(expected = IllegalArgumentException.class)
    public void testThrowsExceptionTickIsAtTimeSeriesEnd() {
        new NR7BreakoutIndicator(new TimeSeries(Arrays.asList(new Tick(null, DateTime.parse("2001-01-01")), new Tick(null, DateTime.parse("2001-01-02")))), 1);
    }
    
    @Test(expected = IllegalArgumentException.class)
    public void testThrowsExceptionTickNotWithinTimeSeries() {
        new NR7BreakoutIndicator(new TimeSeries(Arrays.asList(new Tick(null, DateTime.parse("2001-01-01")), new Tick(null, DateTime.parse("2001-01-02")))), 2);
    }
    
    @Test
    public void testAtIndexLessThanNrIndexReturnsNull() {
        TimeSeries timeSeries = new TimeSeries(StubDataTestUtils.createTickData("/TEST_NR7_BREAKOUT_INDICATOR_TC2.stub"));
        NR7BreakoutIndicator breakoutIndicator = new NR7BreakoutIndicator(timeSeries, 3);
// Path: src/main/java/au/net/woodberry/ta/toolbox/enums/Sentiment.java
// public enum Sentiment {
//     
//     BULLISH, NEUTRAL, BEARISH;
// }
// 
// Path: src/test/java/au/net/woodberry/ta/toolbox/indicators/StubDataTestUtils.java
// public class StubDataTestUtils {
// 
//     private static final String SEPARATOR = ",";
//     private static final String COMMENT_LINE = "#";
//     private static final int TIMESTAMP = 0;
//     private static final int OPEN = 1;
//     private static final int HIGH = 2;
//     private static final int LOW = 3;
//     private static final int CLOSE = 4;
//     private static final int VOLUME = 5;
// 
//     private StubDataTestUtils() {}
// 
//     public static List<Tick> createTickData(String stubData) {
//         return createTickData(stubData, SEPARATOR, null, null);
//     }
//     
//     public static List<Tick> createTickData(String stubData, DateTimeFormatter dtf) {
//         return createTickData(stubData, SEPARATOR, null, dtf);
//     }
// 
//     public static List<Tick> createTickData(String stubData, String separator, Pattern header, DateTimeFormatter dtf) {
//         List<Tick> ticks = new ArrayList<>();
//         BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(StubDataTestUtils.class.getResourceAsStream(stubData)));
//         String line;
//         try {
//             while ((line = bufferedReader.readLine()) != null) {
//                 String[] data = line.split(separator);
//                 if (data == null || (header != null && header.matcher(line).matches()) || line.startsWith(COMMENT_LINE)) { // Headers, comments, no data
//                     continue;
//                 }
//                 DateTime dt = dtf != null ? DateTime.parse(data[TIMESTAMP], dtf) : DateTime.parse(data[TIMESTAMP]);
//                 Tick tick = new Tick(dt, Double.parseDouble(data[OPEN]), Double.parseDouble(data[HIGH]), Double.parseDouble(data[LOW]),
//                         Double.parseDouble(data[CLOSE]), Double.parseDouble(data[VOLUME]));
//                 ticks.add(tick);
//             }
//             bufferedReader.close();
//         } catch (IOException e) {
//             throw new RuntimeException(e);
//         }
//         return ticks;
//     }
// }
// 
// Path: src/main/java/au/net/woodberry/ta/toolbox/object/NR7Breakout.java
// public class NR7Breakout {
//     
//     private final Sentiment sentiment;
//     private final Tick nr7;
//     private final Tick breakout;
// 
//     /**
//      * *
//      * @param nr7 The tick at which the nr7 pattern has formed and the pattern ends
//      * @param breakout The tick at which a breakout is signalled
//      * @param sentiment The sentiment of the breakout
//      */
//     public NR7Breakout(Tick nr7, Tick breakout, Sentiment sentiment) {
//         this.nr7 = nr7;
//         this.breakout = breakout;
//         this.sentiment = sentiment;
//     }
// 
//     public Sentiment getSentiment() {
//         return sentiment;
//     }
// 
//     public Tick getNr7() {
//         return nr7;
//     }
// 
//     public Tick getBreakout() {
//         return breakout;
//     }
// 
//     @Override
//     public String toString() {
//         return "NR7 tick: [Date: " + nr7.getEndTime() + "] " +
//                "Breakout Tick: [Date:" + breakout.getEndTime() + "] " +
//                "Sentiment: " + sentiment;
//     }
// }


// Path: src/test/java/au/net/woodberry/ta/toolbox/indicators/breakout/NR7BreakoutIndicatorTest.java
import au.net.woodberry.ta.toolbox.enums.Sentiment;
import au.net.woodberry.ta.toolbox.indicators.StubDataTestUtils;
import au.net.woodberry.ta.toolbox.object.NR7Breakout;
import eu.verdelhan.ta4j.Tick;
import eu.verdelhan.ta4j.TimeSeries;
import org.joda.time.DateTime;
import org.junit.Test;
import java.util.Arrays;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;

package au.net.woodberry.ta.toolbox.indicators.breakout;




public class NR7BreakoutIndicatorTest {
    
    @Test(expected = IllegalArgumentException.class)
    public void testThrowsExceptionNullTimeSeries() {
        new NR7BreakoutIndicator(null, 0);
    }

    @Test(expected = IllegalArgumentException.class)
    public void testThrowsExceptionTimeSeriesSizeIsTooSmall() {
        new NR7BreakoutIndicator(new TimeSeries(Arrays.asList(new Tick(null, null))), 0);
    }

    @Test(expected = IllegalArgumentException.class)
    public void testThrowsExceptionTickIsAtTimeSeriesEnd() {
        new NR7BreakoutIndicator(new TimeSeries(Arrays.asList(new Tick(null, DateTime.parse("2001-01-01")), new Tick(null, DateTime.parse("2001-01-02")))), 1);
    }
    
    @Test(expected = IllegalArgumentException.class)
    public void testThrowsExceptionTickNotWithinTimeSeries() {
        new NR7BreakoutIndicator(new TimeSeries(Arrays.asList(new Tick(null, DateTime.parse("2001-01-01")), new Tick(null, DateTime.parse("2001-01-02")))), 2);
    }
    
    @Test
    public void testAtIndexLessThanNrIndexReturnsNull() {
        TimeSeries timeSeries = new TimeSeries(StubDataTestUtils.createTickData("/TEST_NR7_BREAKOUT_INDICATOR_TC2.stub"));
        NR7BreakoutIndicator breakoutIndicator = new NR7BreakoutIndicator(timeSeries, 3);
        NR7Breakout value = breakoutIndicator.getValue(2);