Example usage for org.springframework.data.rest.core.mapping ResourceMappings getMetadataFor

List of usage examples for org.springframework.data.rest.core.mapping ResourceMappings getMetadataFor

Introduction

In this page you can find the example usage for org.springframework.data.rest.core.mapping ResourceMappings getMetadataFor.

Prototype

ResourceMetadata getMetadataFor(Class<?> type);

Source Link

Document

Returns a ResourceMetadata for the given type if available.

Usage

From source file:org.moserp.common.structure.factories.AssociationPropertyFactoryTest.java

@Before
public void setup() {
    when(persistentProperty.isAssociation()).thenReturn(true);
    when(persistentProperty.getActualType()).thenReturn((Class) OtherRepositoryClass.class);
    when(persistentProperty.getType()).thenReturn((Class) OtherRepositoryClass.class);

    ResourceMappings mappings = mock(ResourceMappings.class);
    ResourceMetadata metaData = mock(ResourceMetadata.class);
    when(metaData.getPath()).thenReturn(new Path("otherRepositoryClasses"));
    when(metaData.isExported()).thenReturn(true);
    when(mappings.getMetadataFor(eq(OtherRepositoryClass.class))).thenReturn(metaData);

    ModuleRegistry moduleRegistry = mock(ModuleRegistry.class);
    when(moduleRegistry.getModuleForResource(anyString())).thenReturn("environment-module");

    propertyFactory = new AssociationPropertyFactory(createConfiguration(), mappings, moduleRegistry);
}