### Question:
TimeSeries implements Serializable { public TimeSeries subseries(int beginIndex, int endIndex) { if (maximumTickCount != Integer.MAX_VALUE) { throw new IllegalStateException("Cannot create a sub-series from a time series for which a maximum tick count has been set"); } return new TimeSeries(name, ticks, beginIndex, endIndex, true); } TimeSeries(String name, List<Tick> ticks);  TimeSeries(List<Tick> ticks);  TimeSeries(String name);  TimeSeries(); private  TimeSeries(String name, List<Tick> ticks, int beginIndex, int endIndex, boolean subSeries); String getName(); Tick getTick(int i); Tick getFirstTick(); Tick getLastTick(); int getTickCount(); int getBegin(); int getEnd(); String getSeriesPeriodDescription(); void setMaximumTickCount(int maximumTickCount); int getMaximumTickCount(); int getRemovedTicksCount(); void addTick(Tick tick); TimeSeries subseries(int beginIndex, int endIndex); TimeSeries subseries(int beginIndex, Period duration); List<TimeSeries> split(int nbTicks); List<TimeSeries> split(Period splitDuration, Period sliceDuration); List<TimeSeries> split(Period duration); TradingRecord run(Strategy strategy); TradingRecord run(Strategy strategy, OrderType orderType); TradingRecord run(Strategy strategy, OrderType orderType, Decimal amount);  }### Answer:
@Test(expected = IllegalArgumentException.class) public void subseriesWithInvalidIndexesShouldThrowException() { defaultSeries.subseries(4, 2); }