@Test public final void shouldComparatorFindPriorityFieldAndCompareEntities() throws Exception { final String priorityFieldName = "priority123field"; Comparator<Entity> entityPriorityComparator = priorityServiceImpl.getEntityPriorityComparator(); mockPriorityFieldDefinition(firstEntity, priorityFieldName); mockPriorityFieldDefinition(secondEntity, priorityFieldName); given(firstEntity.getField(priorityFieldName)).willReturn(1); given(secondEntity.getField(priorityFieldName)).willReturn(2); int comparationResult = entityPriorityComparator.compare(firstEntity, secondEntity); verify(firstEntity).getField(priorityFieldName); verify(secondEntity).getField(priorityFieldName); Assert.assertEquals(-1, comparationResult); }
@Override public Comparator<Entity> getEntityPriorityComparator() { return entityPriorityComparator; }
PriorityServiceImpl implements PriorityService { @Override public Comparator<Entity> getEntityPriorityComparator() { return entityPriorityComparator; } }
PriorityServiceImpl implements PriorityService { @Override public Comparator<Entity> getEntityPriorityComparator() { return entityPriorityComparator; }  }
PriorityServiceImpl implements PriorityService { @Override public Comparator<Entity> getEntityPriorityComparator() { return entityPriorityComparator; }  @Override void prioritizeEntity(final InternalDataDefinition dataDefinition, final Object databaseEntity); @Override void deprioritizeEntity(final InternalDataDefinition dataDefinition, final Object databaseEntity); @Override void move(final InternalDataDefinition dataDefinition, final Object databaseEntity, final int position,
            final int offset); @Override Comparator<Entity> getEntityPriorityComparator(); }
PriorityServiceImpl implements PriorityService { @Override public Comparator<Entity> getEntityPriorityComparator() { return entityPriorityComparator; }  @Override void prioritizeEntity(final InternalDataDefinition dataDefinition, final Object databaseEntity); @Override void deprioritizeEntity(final InternalDataDefinition dataDefinition, final Object databaseEntity); @Override void move(final InternalDataDefinition dataDefinition, final Object databaseEntity, final int position,
            final int offset); @Override Comparator<Entity> getEntityPriorityComparator();  }