@Test void containsComputedAttribute() { EntityType entityType = mock(EntityType.class); @SuppressWarnings("unchecked") Query<Entity> q = mock(Query.class); QueryRule qRule1 = mock(QueryRule.class); QueryRule qRule2 = mock(QueryRule.class); when(qRule1.getField()).thenReturn("attr1"); when(qRule2.getField()).thenReturn("attr2"); when(qRule1.getNestedRules()).thenReturn(Collections.emptyList()); when(qRule2.getNestedRules()).thenReturn(Collections.emptyList()); when(q.getRules()).thenReturn(Lists.newArrayList(qRule1, qRule2)); Attribute attr1 = mock(Attribute.class); when(entityType.getAttribute("attr1")).thenReturn(attr1); when(attr1.hasExpression()).thenReturn(false); Attribute attr2 = mock(Attribute.class); when(entityType.getAttribute("attr2")).thenReturn(attr2); when(attr2.hasExpression()).thenReturn(true); assertTrue(QueryUtils.containsComputedAttribute(q.getRules(), entityType)); }
public static boolean containsComputedAttribute(Query<Entity> query, EntityType entityType) { return (containsComputedAttribute(query.getSort(), entityType) || containsComputedAttribute(query.getRules(), entityType)); }
QueryUtils { public static boolean containsComputedAttribute(Query<Entity> query, EntityType entityType) { return (containsComputedAttribute(query.getSort(), entityType) || containsComputedAttribute(query.getRules(), entityType)); } }
QueryUtils { public static boolean containsComputedAttribute(Query<Entity> query, EntityType entityType) { return (containsComputedAttribute(query.getSort(), entityType) || containsComputedAttribute(query.getRules(), entityType)); } private  QueryUtils(); }
QueryUtils { public static boolean containsComputedAttribute(Query<Entity> query, EntityType entityType) { return (containsComputedAttribute(query.getSort(), entityType) || containsComputedAttribute(query.getRules(), entityType)); } private  QueryUtils(); static boolean containsOperator(Query<Entity> q, Operator operator); static boolean containsAnyOperator(Query<Entity> q, Set<Operator> operators); static boolean containsAnyOperator(List<QueryRule> rules, Set<Operator> operators); static boolean containsComputedAttribute(Query<Entity> query, EntityType entityType); static boolean containsComputedAttribute(Sort sort, EntityType entityType); static boolean containsComputedAttribute(
      Iterable<QueryRule> rules, EntityType entityType); static boolean containsNestedQueryRuleField(Query<Entity> q); static Attribute getQueryRuleAttribute(QueryRule queryRule, EntityType entityType); static List<Attribute> getAttributePath(String queryRuleField, EntityType entityType); static List<Attribute> getAttributePathExpanded(
      String queryRuleField, EntityType entityType); static List<Attribute> getAttributePathExpanded(
      String queryRuleField, EntityType entityType, boolean expandLabelInsteadOfId); static boolean isTaggedType(Attribute attribute, IRI typeIRI); }
QueryUtils { public static boolean containsComputedAttribute(Query<Entity> query, EntityType entityType) { return (containsComputedAttribute(query.getSort(), entityType) || containsComputedAttribute(query.getRules(), entityType)); } private  QueryUtils(); static boolean containsOperator(Query<Entity> q, Operator operator); static boolean containsAnyOperator(Query<Entity> q, Set<Operator> operators); static boolean containsAnyOperator(List<QueryRule> rules, Set<Operator> operators); static boolean containsComputedAttribute(Query<Entity> query, EntityType entityType); static boolean containsComputedAttribute(Sort sort, EntityType entityType); static boolean containsComputedAttribute(
      Iterable<QueryRule> rules, EntityType entityType); static boolean containsNestedQueryRuleField(Query<Entity> q); static Attribute getQueryRuleAttribute(QueryRule queryRule, EntityType entityType); static List<Attribute> getAttributePath(String queryRuleField, EntityType entityType); static List<Attribute> getAttributePathExpanded(
      String queryRuleField, EntityType entityType); static List<Attribute> getAttributePathExpanded(
      String queryRuleField, EntityType entityType, boolean expandLabelInsteadOfId); static boolean isTaggedType(Attribute attribute, IRI typeIRI);  }