use of io.crnk.core.engine.filter.DocumentFilter in project crnk-framework by crnk-project.
the class ModuleRegistryTest method checkDocumentFilterPriority.
@Test
public void checkDocumentFilterPriority() {
PrioDocumentFilter filter1 = Mockito.mock(PrioDocumentFilter.class);
PrioDocumentFilter filter2 = Mockito.mock(PrioDocumentFilter.class);
Mockito.when(filter1.getPriority()).thenReturn(2);
Mockito.when(filter2.getPriority()).thenReturn(1);
ModuleRegistry moduleRegistry = new ModuleRegistry();
SimpleModule module = new SimpleModule("test");
module.addFilter(filter1);
module.addFilter(filter2);
moduleRegistry.addModule(module);
moduleRegistry.init(new ObjectMapper());
List<DocumentFilter> filters = moduleRegistry.getFilters();
Assert.assertSame(filter2, filters.get(0));
Assert.assertSame(filter1, filters.get(1));
}
Aggregations