### Question:
AnimationExaminationUtils { public static Pair<TimeSpan, Duration> getSpanAndDuration(AnimationPlan plan) { List<? extends TimeSpan> sequence = plan.getAnimationSequence(); Duration maxDuration = Seconds.ZERO; for (TimeSpan span : sequence) { if (span.getDuration().compareTo(maxDuration) > 0) { maxDuration = span.getDuration(); } } Duration duration = new DurationUnitsProvider().getLargestIntegerUnitType(maxDuration); if (duration == null || duration.getMagnitude().intValue() != 1) { duration = Months.ONE; } Date start = determineStartDate(sequence.get(0), duration.getClass()); Date end = determineEndDate(sequence.get(sequence.size() - 1), duration.getClass()); TimeSpan span = TimeSpan.get(start, end); return new Pair<TimeSpan, Duration>(span, duration); } private  AnimationExaminationUtils(); static Pair<TimeSpan, Duration> getSpanAndDuration(AnimationPlan plan);  }### Answer:
@Test public void testGetSpanAndDuration() throws ParseException { List<TimeSpan> sequence = getSpansForString(ourThreeMonths1); AnimationPlan plan = new DefaultAnimationPlan(sequence, EndBehavior.WRAP); Pair<TimeSpan, Duration> spanAndDur = AnimationExaminationUtils.getSpanAndDuration(plan); Date spanStart = new GregorianCalendar(2013, 9, 1).getTime(); Date spanEnd = new GregorianCalendar(2013, 11, 31).getTime(); TimeSpan monthSpan = TimeSpan.get(spanStart, spanEnd); Assert.assertEquals(monthSpan, spanAndDur.getFirstObject()); Assert.assertEquals(Months.ONE, spanAndDur.getSecondObject()); sequence = getSpansForString(ourThreeMonths2); plan = new DefaultAnimationPlan(sequence, EndBehavior.WRAP); spanAndDur = AnimationExaminationUtils.getSpanAndDuration(plan); Assert.assertEquals(monthSpan, spanAndDur.getFirstObject()); Assert.assertEquals(Months.ONE, spanAndDur.getSecondObject()); sequence = getSpansForString(ourThreeMonths3); plan = new DefaultAnimationPlan(sequence, EndBehavior.WRAP); spanAndDur = AnimationExaminationUtils.getSpanAndDuration(plan); Assert.assertEquals(monthSpan, spanAndDur.getFirstObject()); Assert.assertEquals(Months.ONE, spanAndDur.getSecondObject()); sequence = getSpansForString(ourFiveWeeks); plan = new DefaultAnimationPlan(sequence, EndBehavior.WRAP); spanAndDur = AnimationExaminationUtils.getSpanAndDuration(plan); spanStart = new GregorianCalendar(2013, 11, 1).getTime(); spanEnd = new GregorianCalendar(2014, 0, 4).getTime(); Assert.assertEquals(TimeSpan.get(spanStart, spanEnd), spanAndDur.getFirstObject()); Assert.assertEquals(Weeks.ONE, spanAndDur.getSecondObject()); sequence = getSpansForString(ourDays); plan = new DefaultAnimationPlan(sequence, EndBehavior.WRAP); spanAndDur = AnimationExaminationUtils.getSpanAndDuration(plan); spanEnd = new GregorianCalendar(2014, 0, 5).getTime(); Assert.assertEquals(TimeSpan.get(spanStart, spanEnd), spanAndDur.getFirstObject()); Assert.assertEquals(Days.ONE, spanAndDur.getSecondObject()); }