### Question:
AggregationUnitFactory { public static AggregationUnit create(final AggregationType type) { switch (type) { case MAX: return new ComparableAggregationUnit(false); case MIN: return new ComparableAggregationUnit(true); case SUM: case COUNT: return new AccumulationAggregationUnit(); case AVG: return new AverageAggregationUnit(); default: throw new UnsupportedOperationException(type.name()); } }  static AggregationUnit create(final AggregationType type);  }### Answer:
@Test public void assertCreateComparableAggregationUnit() { assertThat(AggregationUnitFactory.create(AggregationType.MIN), instanceOf(ComparableAggregationUnit.class)); assertThat(AggregationUnitFactory.create(AggregationType.MAX), instanceOf(ComparableAggregationUnit.class)); }
@Test public void assertCreateAccumulationAggregationUnit() { assertThat(AggregationUnitFactory.create(AggregationType.SUM), instanceOf(AccumulationAggregationUnit.class)); assertThat(AggregationUnitFactory.create(AggregationType.COUNT), instanceOf(AccumulationAggregationUnit.class)); }
@Test public void assertCreateAverageAggregationUnit() { assertThat(AggregationUnitFactory.create(AggregationType.AVG), instanceOf(AverageAggregationUnit.class)); }