@Test public void testIsGroupCoordinatorOrFollowerWithLoggedOutUser() { final long negativeLong = -3L; context.checking(new Expectations() { { List<String> fields = new ArrayList<String>(); fields.add("id"); one(searchRequestBuilder).setResultFields(fields); Class< ? >[] entityTypes = { DomainGroup.class }; one(searchRequestBuilder).setResultTypes(entityTypes); } }); sut = new DomainGroupRoleDeterminer(searchRequestBuilder); assertFalse(sut.isGroupCoordinatorOrFollower(0L, 1L)); assertFalse(sut.isGroupCoordinatorOrFollower(negativeLong, 1L)); context.assertIsSatisfied(); }
public boolean isGroupCoordinatorOrFollower(final long personId, final long domainGroupId) { if (personId <= 0) { return false; } String luceneQuery = String.format("+id:(%d) +followerAndCoordinatorIds:(%d)", domainGroupId, personId); FullTextQuery query = searchRequestBuilder.buildQueryFromNativeSearchString(luceneQuery); return query.getResultSize() == 1; }
DomainGroupRoleDeterminer { public boolean isGroupCoordinatorOrFollower(final long personId, final long domainGroupId) { if (personId <= 0) { return false; } String luceneQuery = String.format("+id:(%d) +followerAndCoordinatorIds:(%d)", domainGroupId, personId); FullTextQuery query = searchRequestBuilder.buildQueryFromNativeSearchString(luceneQuery); return query.getResultSize() == 1; } }
DomainGroupRoleDeterminer { public boolean isGroupCoordinatorOrFollower(final long personId, final long domainGroupId) { if (personId <= 0) { return false; } String luceneQuery = String.format("+id:(%d) +followerAndCoordinatorIds:(%d)", domainGroupId, personId); FullTextQuery query = searchRequestBuilder.buildQueryFromNativeSearchString(luceneQuery); return query.getResultSize() == 1; } DomainGroupRoleDeterminer(final ProjectionSearchRequestBuilder inSearchRequestBuilder); }
DomainGroupRoleDeterminer { public boolean isGroupCoordinatorOrFollower(final long personId, final long domainGroupId) { if (personId <= 0) { return false; } String luceneQuery = String.format("+id:(%d) +followerAndCoordinatorIds:(%d)", domainGroupId, personId); FullTextQuery query = searchRequestBuilder.buildQueryFromNativeSearchString(luceneQuery); return query.getResultSize() == 1; } DomainGroupRoleDeterminer(final ProjectionSearchRequestBuilder inSearchRequestBuilder); boolean isGroupCoordinatorOrFollower(final long personId, final long domainGroupId); }
DomainGroupRoleDeterminer { public boolean isGroupCoordinatorOrFollower(final long personId, final long domainGroupId) { if (personId <= 0) { return false; } String luceneQuery = String.format("+id:(%d) +followerAndCoordinatorIds:(%d)", domainGroupId, personId); FullTextQuery query = searchRequestBuilder.buildQueryFromNativeSearchString(luceneQuery); return query.getResultSize() == 1; } DomainGroupRoleDeterminer(final ProjectionSearchRequestBuilder inSearchRequestBuilder); boolean isGroupCoordinatorOrFollower(final long personId, final long domainGroupId);  }