### Question:
DefaultPageQueryBuilder implements QueryBuilder<PageClass> { @Override public Query build(PageClass pageClass) throws QueryException { Query query; if (StringUtils.isEmpty(pageClass.getSql())) { query = this.implicitlyAllowedValuesQueryBuilder.build(pageClass); query.addFilter(hiddenFilterProvider.get()); query.addFilter(this.documentFilter); } else { query = this.explicitlyAllowedValuesQueryBuilder.build(pageClass); query.addFilter(this.documentFilter); query.addFilter(this.viewableFilter); } return query; }  @Override Query build(PageClass pageClass);  }### Answer:
@Test public void build() throws Exception { PageClass pageClass = new PageClass(); Query explicitlyAllowedValuesQuery = mock(Query.class, "explicit"); when(this.explicitlyAllowedValuesQueryBuilder.build(pageClass)).thenReturn(explicitlyAllowedValuesQuery); Query implicitlyAllowedValuesQuery = mock(Query.class, "implicit"); when(this.implicitlyAllowedValuesQueryBuilder.build(pageClass)).thenReturn(implicitlyAllowedValuesQuery); assertSame(implicitlyAllowedValuesQuery, this.queryBuilder.build(pageClass)); pageClass.setSql("test"); assertSame(explicitlyAllowedValuesQuery, this.queryBuilder.build(pageClass)); }