@Test
public void testReturnsTheClosestMatchByWidthIfNoExactMatchPresentAndRunsTheProcess()
	throws Exception {

	AMImageConfigurationEntry getConfigurationEntryFilter =
		_createAMImageConfigurationEntry(
			_fileVersion.getCompanyId(), 200, 500);
	AMImageConfigurationEntry closestAMImageConfigurationEntry =
		_createAMImageConfigurationEntry(
			_fileVersion.getCompanyId(), 201, 501);
	AMImageConfigurationEntry fartherAMImageConfigurationEntry =
		_createAMImageConfigurationEntry(
			_fileVersion.getCompanyId(), 301, 501);
	AMImageConfigurationEntry farthestAMImageConfigurationEntry =
		_createAMImageConfigurationEntry(
			_fileVersion.getCompanyId(), 401, 501);
	AdaptiveMedia<AMImageProcessor> closestAdaptiveMedia =
		_createAdaptiveMedia(
			_fileVersion, closestAMImageConfigurationEntry);
	AdaptiveMedia<AMImageProcessor> fartherAdaptiveMedia =
		_createAdaptiveMedia(
			_fileVersion, fartherAMImageConfigurationEntry);
	AdaptiveMedia<AMImageProcessor> farthestAdaptiveMedia =
		_createAdaptiveMedia(
			_fileVersion, farthestAMImageConfigurationEntry);
	_mockClosestMatch(
		_fileVersion, getConfigurationEntryFilter,
		Arrays.asList(
			farthestAdaptiveMedia, closestAdaptiveMedia,
			fartherAdaptiveMedia));
	HttpServletRequest httpServletRequest = _createRequestFor(
		_fileVersion, getConfigurationEntryFilter);
	Assert.assertEquals(
		Optional.of(closestAdaptiveMedia),
		_amImageRequestHandler.handleRequest(httpServletRequest));
	Mockito.verify(
		_amAsyncProcessor
	).triggerProcess(
		_fileVersion, String.valueOf(_fileVersion.getFileVersionId())
	);
}