@Test public void buildQuery() throws Exception { String queryBean = PowerMockito.mock(String.class); PowerMockito.mockStatic(QueryBeanFactory.class); QueryType detail = QueryType.DETAIL; QueryType group = QueryType.GROUP; QueryInfoBean detailQueryInfoBean = PowerMockito.mock(DetailQueryInfoBean.class); PowerMockito.when(QueryBeanFactory.create(queryBean)).thenReturn(detailQueryInfoBean); PowerMockito.when(detailQueryInfoBean.getQueryType()).thenReturn(detail); DetailQueryBuilder detailQueryBuilder = PowerMockito.mock(DetailQueryBuilder.class); PowerMockito.mockStatic(DetailQueryBuilder.class); PowerMockito.when(DetailQueryBuilder.of((DetailQueryInfoBean) detailQueryInfoBean)).thenReturn(detailQueryBuilder); Query detailQuery = PowerMockito.mock(Query.class); PowerMockito.when(detailQueryBuilder.buildQuery()).thenReturn(detailQuery); Assert.assertEquals(detailQuery, QueryBuilder.buildQuery(queryBean)); QueryInfoBean groupQueryInfoBean = PowerMockito.mock(GroupQueryInfoBean.class); PowerMockito.when(QueryBeanFactory.create(queryBean)).thenReturn(groupQueryInfoBean); PowerMockito.when(groupQueryInfoBean.getQueryType()).thenReturn(group); GroupQueryBuilder groupQueryBuilder = PowerMockito.mock(GroupQueryBuilder.class); PowerMockito.mockStatic(GroupQueryBuilder.class); PowerMockito.when(GroupQueryBuilder.get()).thenReturn(groupQueryBuilder); Query groupQuery = PowerMockito.mock(Query.class); PowerMockito.when(groupQueryBuilder.buildQuery((GroupQueryInfoBean) groupQueryInfoBean)).thenReturn(groupQuery); Assert.assertEquals(groupQuery, QueryBuilder.buildQuery(queryBean)); }
public static <T extends QueryResultSet<?>> Query<T> buildQuery(String queryString) throws Exception { QueryInfoBean bean = QueryBeanFactory.create(queryString); return buildQuery(bean); }
QueryBuilder { public static <T extends QueryResultSet<?>> Query<T> buildQuery(String queryString) throws Exception { QueryInfoBean bean = QueryBeanFactory.create(queryString); return buildQuery(bean); } }
QueryBuilder { public static <T extends QueryResultSet<?>> Query<T> buildQuery(String queryString) throws Exception { QueryInfoBean bean = QueryBeanFactory.create(queryString); return buildQuery(bean); }  }
QueryBuilder { public static <T extends QueryResultSet<?>> Query<T> buildQuery(String queryString) throws Exception { QueryInfoBean bean = QueryBeanFactory.create(queryString); return buildQuery(bean); }  static Query<T> buildQuery(String queryString); static Query<T> buildQuery(QueryBean bean); static Query<T> buildPostQuery(final T mergeResultSet, QueryBean bean); }
QueryBuilder { public static <T extends QueryResultSet<?>> Query<T> buildQuery(String queryString) throws Exception { QueryInfoBean bean = QueryBeanFactory.create(queryString); return buildQuery(bean); }  static Query<T> buildQuery(String queryString); static Query<T> buildQuery(QueryBean bean); static Query<T> buildPostQuery(final T mergeResultSet, QueryBean bean);  }