### Question:
TimeSeries implements Serializable { public void setMaximumTickCount(int maximumTickCount) { if (subSeries) { throw new IllegalStateException("Cannot set a maximum tick count on a sub-series"); } if (maximumTickCount <= 0) { throw new IllegalArgumentException("Maximum tick count must be strictly positive"); } this.maximumTickCount = maximumTickCount; removeExceedingTicks(); } 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 = IllegalStateException.class) public void maximumTickCountOnSubserieShouldThrowException() { subSeries.setMaximumTickCount(10); }
@Test(expected = IllegalArgumentException.class) public void negativeMaximumTickCountShouldThrowException() { defaultSeries.setMaximumTickCount(-1); }
@Test public void setMaximumTickCount() { assertEquals(0, defaultSeries.getBegin()); assertEquals(ticks.size() - 1, defaultSeries.getEnd()); assertEquals(ticks.size(), defaultSeries.getTickCount()); defaultSeries.setMaximumTickCount(3); assertEquals(0, defaultSeries.getBegin()); assertEquals(5, defaultSeries.getEnd()); assertEquals(3, defaultSeries.getTickCount()); }