@Test public void testMatches() { NoteData note = new NoteData(); note.setId(0L); FavoriteManagement favoriteManagement = EasyMock.createMock(FavoriteManagement.class); EasyMock.expect(favoriteManagement.isFavorite(EasyMock.anyLong())).andAnswer( new IAnswer<Boolean>() { @Override public Boolean answer() throws Throwable { return EasyMock.getCurrentArguments()[0].equals(1L); } }).anyTimes(); EasyMock.replay(favoriteManagement); Matcher<NoteData> matcher = new FavoriteMatcher(favoriteManagement); Assert.assertFalse(matcher.matches(note)); note.setId(1L); Assert.assertTrue(matcher.matches(note)); }
@Override public boolean matches(NoteData entity) { return favoriteManagement.isFavorite(entity.getId()); }
FavoriteMatcher extends Matcher<NoteData> { @Override public boolean matches(NoteData entity) { return favoriteManagement.isFavorite(entity.getId()); } }
FavoriteMatcher extends Matcher<NoteData> { @Override public boolean matches(NoteData entity) { return favoriteManagement.isFavorite(entity.getId()); } FavoriteMatcher(FavoriteManagement favoriteManagement); }
FavoriteMatcher extends Matcher<NoteData> { @Override public boolean matches(NoteData entity) { return favoriteManagement.isFavorite(entity.getId()); } FavoriteMatcher(FavoriteManagement favoriteManagement); @Override boolean matches(NoteData entity); }
FavoriteMatcher extends Matcher<NoteData> { @Override public boolean matches(NoteData entity) { return favoriteManagement.isFavorite(entity.getId()); } FavoriteMatcher(FavoriteManagement favoriteManagement); @Override boolean matches(NoteData entity);  }