If you are using Core Components and the Template Editor in AEM, you are also depending on Content Policies and have to test your component code with them. AEM Mocks 2.7.0 supports them in a easy way.
Example for creating a content policy on-the-fly using the AemContext:
// create a content policy with mapping for resource type
This creates a new content policy for the resource type app1/componenty/component1. If your Sling Model is adapted from a resource with this resource type and injects a content policy it will get the mapping provided with the lines above in the unit test. This makes it easy testing it with different variants.
Advanced image file format support in AEM Mocks
AEM Assets supports a wide range of image file formats, whereas in unit tests with AEM Mocks it was only possible to use GIF, PNG and JPEG in combination with the AEM Layer class.
AEM Mocks 2.7.0 provides also support for TIFF and SVG file formats if you configure additional Java ImageIO plugins in your project as test dependency.
Additionally there is a mock implementation of the AssetStore DAM service and an AssetHandler that supports the old and the new file formats.
AEM Mocks 2.5.0 comes with a support for Content Fragments (CF) - structured and unstructured ones. Structured CF provide “key-value pairs” and unstructured ones only a text fragment. Both can contain variants.
The ContentBuilder provides convenience methods for creating CFs on-the-fly. Example for creating a structured CF: