@Test public void build() throws Exception { PageClass pageClass = mock(PageClass.class); DBListClass dbListClass = mock(DBListClass.class); when(pageClass.clone()).thenReturn(dbListClass); this.queryBuilder.build(pageClass); verify(dbListClass).setIdField("doc.fullName"); when(dbListClass.getIdField()).thenReturn("doc.name"); this.queryBuilder.build(pageClass); verify(dbListClass, times(1)).setIdField("doc.fullName"); }
@Override public Query build(PageClass pageClass) throws QueryException { DBListClass dbListClass = (DBListClass) pageClass.clone(); if (StringUtils.isEmpty(dbListClass.getIdField())) { dbListClass.setIdField("doc.fullName"); } if (StringUtils.isEmpty(dbListClass.getValueField())) { dbListClass.setValueField("doc.title"); } return implicitlyAllowedValuesQueryBuilder.build(dbListClass); }
ImplicitlyAllowedValuesPageQueryBuilder implements QueryBuilder<PageClass> { @Override public Query build(PageClass pageClass) throws QueryException { DBListClass dbListClass = (DBListClass) pageClass.clone(); if (StringUtils.isEmpty(dbListClass.getIdField())) { dbListClass.setIdField("doc.fullName"); } if (StringUtils.isEmpty(dbListClass.getValueField())) { dbListClass.setValueField("doc.title"); } return implicitlyAllowedValuesQueryBuilder.build(dbListClass); } }
ImplicitlyAllowedValuesPageQueryBuilder implements QueryBuilder<PageClass> { @Override public Query build(PageClass pageClass) throws QueryException { DBListClass dbListClass = (DBListClass) pageClass.clone(); if (StringUtils.isEmpty(dbListClass.getIdField())) { dbListClass.setIdField("doc.fullName"); } if (StringUtils.isEmpty(dbListClass.getValueField())) { dbListClass.setValueField("doc.title"); } return implicitlyAllowedValuesQueryBuilder.build(dbListClass); }  }
ImplicitlyAllowedValuesPageQueryBuilder implements QueryBuilder<PageClass> { @Override public Query build(PageClass pageClass) throws QueryException { DBListClass dbListClass = (DBListClass) pageClass.clone(); if (StringUtils.isEmpty(dbListClass.getIdField())) { dbListClass.setIdField("doc.fullName"); } if (StringUtils.isEmpty(dbListClass.getValueField())) { dbListClass.setValueField("doc.title"); } return implicitlyAllowedValuesQueryBuilder.build(dbListClass); }  @Override Query build(PageClass pageClass); }
ImplicitlyAllowedValuesPageQueryBuilder implements QueryBuilder<PageClass> { @Override public Query build(PageClass pageClass) throws QueryException { DBListClass dbListClass = (DBListClass) pageClass.clone(); if (StringUtils.isEmpty(dbListClass.getIdField())) { dbListClass.setIdField("doc.fullName"); } if (StringUtils.isEmpty(dbListClass.getValueField())) { dbListClass.setValueField("doc.title"); } return implicitlyAllowedValuesQueryBuilder.build(dbListClass); }  @Override Query build(PageClass pageClass);  }