@Test
public void testProcessConfigurationWhenFileEntryIsCheckedOut()
	throws Exception {

	Mockito.when(
		_amImageValidator.isProcessingSupported(_fileVersion)
	).thenReturn(
		true
	);
	Mockito.when(
		_amImageConfigurationHelper.getAMImageConfigurationEntry(
			Mockito.anyLong(), Mockito.anyString())
	).thenReturn(
		Optional.of(
			new AMImageConfigurationEntryImpl(
				RandomTestUtil.randomString(),
				RandomTestUtil.randomString(), Collections.emptyMap()))
	);
	Mockito.when(
		_amImageEntryLocalService.fetchAMImageEntry(
			Mockito.anyString(), Mockito.anyLong())
	).thenReturn(
		Mockito.mock(AMImageEntry.class)
	);
	Mockito.when(
		_fileVersion.getFileEntry()
	).thenReturn(
		_fileEntry
	);
	Mockito.when(
		_fileEntry.isCheckedOut()
	).thenReturn(
		true
	);
	Mockito.when(
		_amImageScalerTracker.getAMImageScaler(Mockito.anyString())
	).thenReturn(
		_amImageScaler
	);
	Mockito.when(
		_amImageScaler.scaleImage(
			Mockito.any(FileVersion.class),
			Mockito.any(AMImageConfigurationEntry.class))
	).thenReturn(
		new AMImageScaledImageImpl(new byte[100], 100, 100)
	);
	_amImageProcessorImpl.process(
		_fileVersion, RandomTestUtil.randomString());
	Mockito.verify(
		_amImageEntryLocalService
	).deleteAMImageEntry(
		Mockito.anyLong()
	);
	Mockito.verify(
		_amImageScaler
	).scaleImage(
		Mockito.any(FileVersion.class),
		Mockito.any(AMImageConfigurationEntry.class)
	);
}