@Test
public void testAMReturnTypeIsAddedToAllItemSelectorCriteria()
	throws Exception {

	ItemSelectorCriterion[] itemSelectorCriteria = {
		_initializeItemSelectorCriterion(new BlogsItemSelectorCriterion()),
		_initializeItemSelectorCriterion(new FileItemSelectorCriterion()),
		_initializeItemSelectorCriterion(new ImageItemSelectorCriterion()),
		_initializeItemSelectorCriterion(new UploadItemSelectorCriterion())
	};
	JSONObject jsonObject = JSONUtil.put(
		"filebrowserImageBrowseLinkUrl", RandomTestUtil.randomString());
	when(
		_itemSelector.getItemSelectorCriteria(Mockito.anyString())
	).thenReturn(
		Arrays.asList(itemSelectorCriteria)
	);
	when(
		_itemSelector.getItemSelectedEventName(Mockito.anyString())
	).thenReturn(
		RandomTestUtil.randomString()
	);
	when(
		_itemSelector.getItemSelectorURL(
			Mockito.any(RequestBackedPortletURLFactory.class),
			Mockito.anyString(), Mockito.<ItemSelectorCriterion>anyVararg())
	).thenReturn(
		_portletURL
	);
	when(
		_portletURL.toString()
	).thenReturn(
		RandomTestUtil.randomString()
	);
	AMBlogsEditorConfigContributor amBlogsEditorConfigContributor =
		new AMBlogsEditorConfigContributor();
	ReflectionTestUtil.setFieldValue(
		amBlogsEditorConfigContributor, "_itemSelector", _itemSelector);
	amBlogsEditorConfigContributor.populateConfigJSONObject(
		jsonObject, _inputEditorTaglibAttributes, _themeDisplay,
		_requestBackedPortletURLFactory);
	for (ItemSelectorCriterion itemSelectorCriterion :
			itemSelectorCriteria) {
		List<ItemSelectorReturnType> desiredItemSelectorReturnTypes =
			itemSelectorCriterion.getDesiredItemSelectorReturnTypes();
		Stream<ItemSelectorReturnType> itemSelectorReturnTypeStream =
			desiredItemSelectorReturnTypes.stream();
		Assert.assertTrue(
			itemSelectorReturnTypeStream.allMatch(
				itemSelectorReturnType -> itemSelectorReturnType instanceof
					AMImageFileEntryItemSelectorReturnType));
	}
}