@Test public void build() throws Exception { DBListClass dbListClass = new DBListClass(); DefaultParameterizedType dbListQueryBuilderType = new DefaultParameterizedType(null, QueryBuilder.class, DBListClass.class); QueryBuilder<DBListClass> explicitlyAllowedValuesQueryBuilder = this.mocker.getInstance(dbListQueryBuilderType, "explicitlyAllowedValues"); QueryBuilder<DBListClass> implicitlyAllowedValuesQueryBuilder = this.mocker.getInstance(dbListQueryBuilderType, "implicitlyAllowedValues"); Query explicitlyAllowedValuesQuery = mock(Query.class, "explicit"); when(explicitlyAllowedValuesQueryBuilder.build(dbListClass)).thenReturn(explicitlyAllowedValuesQuery); Query implicitlyAllowedValuesQuery = mock(Query.class, "implicit"); when(implicitlyAllowedValuesQueryBuilder.build(dbListClass)).thenReturn(implicitlyAllowedValuesQuery); assertSame(implicitlyAllowedValuesQuery, this.mocker.getComponentUnderTest().build(dbListClass)); dbListClass.setSql("test"); assertSame(explicitlyAllowedValuesQuery, this.mocker.getComponentUnderTest().build(dbListClass)); }
@Override public Query build(DBListClass dbListClass) throws QueryException { if (StringUtils.isEmpty(dbListClass.getSql())) { return this.implicitlyAllowedValuesQueryBuilder.build(dbListClass); } else { return this.explicitlyAllowedValuesQueryBuilder.build(dbListClass); } }
DefaultDBListQueryBuilder implements QueryBuilder<DBListClass> { @Override public Query build(DBListClass dbListClass) throws QueryException { if (StringUtils.isEmpty(dbListClass.getSql())) { return this.implicitlyAllowedValuesQueryBuilder.build(dbListClass); } else { return this.explicitlyAllowedValuesQueryBuilder.build(dbListClass); } } }
DefaultDBListQueryBuilder implements QueryBuilder<DBListClass> { @Override public Query build(DBListClass dbListClass) throws QueryException { if (StringUtils.isEmpty(dbListClass.getSql())) { return this.implicitlyAllowedValuesQueryBuilder.build(dbListClass); } else { return this.explicitlyAllowedValuesQueryBuilder.build(dbListClass); } }  }
DefaultDBListQueryBuilder implements QueryBuilder<DBListClass> { @Override public Query build(DBListClass dbListClass) throws QueryException { if (StringUtils.isEmpty(dbListClass.getSql())) { return this.implicitlyAllowedValuesQueryBuilder.build(dbListClass); } else { return this.explicitlyAllowedValuesQueryBuilder.build(dbListClass); } }  @Override Query build(DBListClass dbListClass); }
DefaultDBListQueryBuilder implements QueryBuilder<DBListClass> { @Override public Query build(DBListClass dbListClass) throws QueryException { if (StringUtils.isEmpty(dbListClass.getSql())) { return this.implicitlyAllowedValuesQueryBuilder.build(dbListClass); } else { return this.explicitlyAllowedValuesQueryBuilder.build(dbListClass); } }  @Override Query build(DBListClass dbListClass);  }