@Test
public void testGetMediaQueryWithNoMatchingAttributes() throws Exception {

	AMImageConfigurationEntry amImageConfigurationEntry1 =
		new AMImageConfigurationEntryImpl(
			RandomTestUtil.randomString(), RandomTestUtil.randomString(),
			MapUtil.fromArray("max-height", "100"));
	AMImageConfigurationEntry amImageConfigurationEntry2 =
		new AMImageConfigurationEntryImpl(
			RandomTestUtil.randomString(), RandomTestUtil.randomString(),
			MapUtil.fromArray("max-height", "200"));
	AMImageQueryBuilder.ConfigurationStatus enabledConfigurationStatus =
		AMImageQueryBuilder.ConfigurationStatus.ENABLED;
	Mockito.when(
		_amImageConfigurationHelper.getAMImageConfigurationEntries(
			_fileVersion.getCompanyId(),
			enabledConfigurationStatus.getPredicate())
	).thenReturn(
		Arrays.asList(
			amImageConfigurationEntry1, amImageConfigurationEntry2)
	);
	Mockito.when(
		_fileVersion.getFileName()
	).thenReturn(
		RandomTestUtil.randomString()
	);
	Mockito.when(
		_fileVersion.getMimeType()
	).thenReturn(
		"image/jpeg"
	);
	AMImageEntry amImageEntry1 = _mockImage(99, 1000, 1000L);
	Mockito.when(
		_amImageEntryLocalService.fetchAMImageEntry(
			amImageConfigurationEntry1.getUUID(),
			_fileVersion.getFileVersionId())
	).thenReturn(
		amImageEntry1
	);
	AMImageEntry amImageEntry2 = _mockImage(199, 1000, 1000L);
	Mockito.when(
		_amImageEntryLocalService.fetchAMImageEntry(
			amImageConfigurationEntry2.getUUID(),
			_fileVersion.getFileVersionId())
	).thenReturn(
		amImageEntry2
	);
	Mockito.when(
		_amImageMimeTypeProvider.isMimeTypeSupported(Mockito.anyString())
	).thenReturn(
		true
	);
	Stream<AdaptiveMedia<AMImageProcessor>> adaptiveMediaStream =
		_amImageFinderImpl.getAdaptiveMediaStream(
			amImageQueryBuilder -> amImageQueryBuilder.forFileVersion(
				_fileVersion
			).with(
				AMImageAttribute.AM_IMAGE_ATTRIBUTE_WIDTH, 100
			).done());
	List<AdaptiveMedia<AMImageProcessor>> adaptiveMedias =
		adaptiveMediaStream.collect(Collectors.toList());
	AdaptiveMedia<AMImageProcessor> adaptiveMedia0 = adaptiveMedias.get(0);
	Optional<Integer> adaptiveMedia0HeightOptional =
		adaptiveMedia0.getValueOptional(
			AMImageAttribute.AM_IMAGE_ATTRIBUTE_HEIGHT);
	Assert.assertEquals(99, (int)adaptiveMedia0HeightOptional.get());
	AdaptiveMedia<AMImageProcessor> adaptiveMedia1 = adaptiveMedias.get(1);
	Optional<Integer> adaptiveMedia1HeightOptional =
		adaptiveMedia1.getValueOptional(
			AMImageAttribute.AM_IMAGE_ATTRIBUTE_HEIGHT);
	Assert.assertEquals(199, (int)adaptiveMedia1HeightOptional.get());
}