### Question:
AspectRatioSelectors { public static SelectorFunction<Collection<Size>, Size> standardRatio(SelectorFunction<Collection<Size>, Size> selector) { return aspectRatio(4f / 3f, selector); }  static SelectorFunction<Collection<Size>, Size> standardRatio(SelectorFunction<Collection<Size>, Size> selector); static SelectorFunction<Collection<Size>, Size> standardRatio(SelectorFunction<Collection<Size>, Size> selector, double tolerance); static SelectorFunction<Collection<Size>, Size> wideRatio(SelectorFunction<Collection<Size>, Size> selector); static SelectorFunction<Collection<Size>, Size> wideRatio(SelectorFunction<Collection<Size>, Size> selector, double tolerance); static SelectorFunction<Collection<Size>, Size> aspectRatio(float aspectRatio, SelectorFunction<Collection<Size>, Size> selector, double tolerance); static SelectorFunction<Collection<Size>, Size> aspectRatio(float aspectRatio,
                                                     SelectorFunction<Collection<Size>, Size> selector);  }### Answer:
@Test public void standardRatio() throws Exception { given(sizeSelector.select(ArgumentMatchers.<Size>anyCollection())) .willReturn(new Size(4, 3)); Size result = AspectRatioSelectors .standardRatio(sizeSelector) .select(asList( new Size(4, 3), new Size(8, 6), new Size(10, 10) )); assertEquals( new Size(4, 3), result ); verify(sizeSelector).select(asSet( new Size(4, 3), new Size(8, 6) )); }
@Test public void standardRatioWithTolerance() throws Exception { given(sizeSelector.select(ArgumentMatchers.<Size>anyCollection())) .willReturn(new Size(400, 300)); Size result = AspectRatioSelectors .standardRatio(sizeSelector, 0.1) .select(asList( new Size(400, 300), new Size(410, 300), new Size(800, 600), new Size(790, 600), new Size(100, 100), new Size(160, 90) )); assertEquals( new Size(400, 300), result ); verify(sizeSelector).select(asSet( new Size(400, 300), new Size(410, 300), new Size(800, 600), new Size(790, 600) )); }