@Test public void testMatches() { NoteData note = new NoteData(); note.setUser(new DetailedUserData()); String userAlias = UUID.randomUUID().toString(); note.getUser().setAlias(UUID.randomUUID().toString()); Matcher<NoteData> matcher = new UserAliasesMatcher(userAlias); Assert.assertFalse(matcher.matches(note)); note.getUser().setAlias(userAlias); Assert.assertTrue(matcher.matches(note)); matcher = new UserAliasesMatcher(userAlias, userAlias + 1); Assert.assertTrue(matcher.matches(note)); }
@Override public boolean matches(NoteData entity) { if (userAliases == null || userAliases.length == 0) { return true; } for (String userAlias : userAliases) { if (userAlias.equals(entity.getUser().getAlias())) { return true; } } return false; }
UserAliasesMatcher extends Matcher<NoteData> { @Override public boolean matches(NoteData entity) { if (userAliases == null || userAliases.length == 0) { return true; } for (String userAlias : userAliases) { if (userAlias.equals(entity.getUser().getAlias())) { return true; } } return false; } }
UserAliasesMatcher extends Matcher<NoteData> { @Override public boolean matches(NoteData entity) { if (userAliases == null || userAliases.length == 0) { return true; } for (String userAlias : userAliases) { if (userAlias.equals(entity.getUser().getAlias())) { return true; } } return false; } UserAliasesMatcher(String... userAliases); }
UserAliasesMatcher extends Matcher<NoteData> { @Override public boolean matches(NoteData entity) { if (userAliases == null || userAliases.length == 0) { return true; } for (String userAlias : userAliases) { if (userAlias.equals(entity.getUser().getAlias())) { return true; } } return false; } UserAliasesMatcher(String... userAliases); @Override boolean matches(NoteData entity); }
UserAliasesMatcher extends Matcher<NoteData> { @Override public boolean matches(NoteData entity) { if (userAliases == null || userAliases.length == 0) { return true; } for (String userAlias : userAliases) { if (userAlias.equals(entity.getUser().getAlias())) { return true; } } return false; } UserAliasesMatcher(String... userAliases); @Override boolean matches(NoteData entity);  }