Package org.anchoranalysis.test.image.io
Class BeanInstanceMapFixture
Object
org.anchoranalysis.test.image.io.BeanInstanceMapFixture
public class BeanInstanceMapFixture extends Object
Creates a
BeanInstanceMap with useful entries for testing, and associates it with bean
creation.- Author:
- Owen Feehan
-
Method Summary
Modifier and Type Method Description static <T extends org.anchoranalysis.bean.AnchorBean<?>>
Tcheck(T bean)Checks if a bean has all necessary items, throwing a run-time exception if it does not.static ImageMetadataReaderensureImageMetadataReader()Ensure aImageMetadataReaderinstance exists in the underlyingBeanInstanceMap.static InterpolatorensureInterpolator()Ensure a defaultInterpolatorinstance exists in the underlyingBeanInstanceMap.static InterpolatorensureInterpolator(Interpolator interpolator)Ensure a specificInterpolatorinstance exists in the underlyingBeanInstanceMap.static StackDisplayerensureStackDisplayer()Ensure aStackDisplayerinstance exists in the underlyingBeanInstanceMap.static StackReaderensureStackReader()Ensure aStackReaderinstance exists in the underlyingBeanInstanceMap.static StackWriterensureStackWriter(boolean tiff)Ensure aStackWriterinstance exists in the underlyingBeanInstanceMap.static voidremoveStackWriter()Removes anyStackWriterthat may exist in the underlyingBeanInstanceMap.
-
Method Details
-
ensureStackReader
Ensure aStackReaderinstance exists in the underlyingBeanInstanceMap.- Returns:
- the instance, as already exists, or if newly created.
-
ensureStackWriter
Ensure aStackWriterinstance exists in the underlyingBeanInstanceMap.This leaves a global side-affect after being used, which may affect subsequent tests run in the same maven unit.
- Parameters:
tiff- if true, TIFFs are created, otherwise PNGs.- Returns:
- the instance, as already exists, or if newly created.
-
removeStackWriter
public static void removeStackWriter()Removes anyStackWriterthat may exist in the underlyingBeanInstanceMap. -
ensureImageMetadataReader
Ensure aImageMetadataReaderinstance exists in the underlyingBeanInstanceMap.- Returns:
- the instance, as already exists, or if newly created.
-
ensureInterpolator
Ensure a defaultInterpolatorinstance exists in the underlyingBeanInstanceMap.- Returns:
- the instance, as already exists, or if newly created.
-
ensureInterpolator
Ensure a specificInterpolatorinstance exists in the underlyingBeanInstanceMap.- Parameters:
interpolator- the interpolator to add, if necessary.- Returns:
- the instance, as already exists, or if newly created.
-
ensureStackDisplayer
Ensure aStackDisplayerinstance exists in the underlyingBeanInstanceMap.- Returns:
- the instance, as already exists, or if newly created.
-
check
public static <T extends org.anchoranalysis.bean.AnchorBean<?>> T check(T bean)Checks if a bean has all necessary items, throwing a run-time exception if it does not.- Type Parameters:
T- bean-type- Parameters:
bean- bean to check.- Returns:
- the checked bean
- Throws:
AnchorFriendlyRuntimeException- if the bean is misconfigured
-