@Test public final void shouldThrowExceptionIfEntityDoNotHavePriorityFields() throws Exception { Comparator<Entity> entityPriorityComparator = priorityServiceImpl.getEntityPriorityComparator(); DataDefinition dataDefinition = mock(DataDefinition.class); given(firstEntity.getDataDefinition()).willReturn(dataDefinition); given(secondEntity.getDataDefinition()).willReturn(dataDefinition); given(dataDefinition.getPriorityField()).willReturn(null); boolean success = false; try { entityPriorityComparator.compare(firstEntity, secondEntity); } catch (NullPointerException e) { success = true; } Assert.assertTrue(success); }
@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();  }