@Test public void buildPostQuery() throws Exception { QueryInfoBean bean = PowerMockito.mock(QueryInfoBean.class); PowerMockito.mockStatic(QueryInfoParser.class); List postQueryInfoList = new ArrayList(); PowerMockito.when(QueryInfoParser.parsePostQuery(bean)).thenReturn(postQueryInfoList); QueryType groupType = QueryType.GROUP; PowerMockito.when(bean.getQueryType()).thenReturn(groupType); QueryResultSet queryResultSet = PowerMockito.mock(QueryResultSet.class); UpdateNodeDataQuery updateNodeDataQuery = PowerMockito.mock(UpdateNodeDataQuery.class); PowerMockito.whenNew(UpdateNodeDataQuery.class).withArguments(queryResultSet).thenReturn(updateNodeDataQuery); Query query = PowerMockito.mock(Query.class); PowerMockito.mockStatic(PostQueryBuilder.class); PowerMockito.when(PostQueryBuilder.buildQuery(updateNodeDataQuery, postQueryInfoList)).thenReturn(query); Assert.assertEquals(query, QueryBuilder.buildPostQuery(queryResultSet, bean)); }
public static <T extends QueryResultSet<?>> Query<T> buildPostQuery(final T mergeResultSet, QueryBean bean) { List<PostQueryInfo> postQueryInfoList = QueryInfoParser.parsePostQuery((QueryInfoBean) bean); Query<T> query; if (bean.getQueryType() == QueryType.GROUP) { query = (Query<T>) new UpdateNodeDataQuery((QueryResultSet<GroupPage>) mergeResultSet); } else { query = new Query<T>() { @Override public T getQueryResult() { return mergeResultSet; } }; } return PostQueryBuilder.buildQuery(query, postQueryInfoList); }
QueryBuilder { public static <T extends QueryResultSet<?>> Query<T> buildPostQuery(final T mergeResultSet, QueryBean bean) { List<PostQueryInfo> postQueryInfoList = QueryInfoParser.parsePostQuery((QueryInfoBean) bean); Query<T> query; if (bean.getQueryType() == QueryType.GROUP) { query = (Query<T>) new UpdateNodeDataQuery((QueryResultSet<GroupPage>) mergeResultSet); } else { query = new Query<T>() { @Override public T getQueryResult() { return mergeResultSet; } }; } return PostQueryBuilder.buildQuery(query, postQueryInfoList); } }
QueryBuilder { public static <T extends QueryResultSet<?>> Query<T> buildPostQuery(final T mergeResultSet, QueryBean bean) { List<PostQueryInfo> postQueryInfoList = QueryInfoParser.parsePostQuery((QueryInfoBean) bean); Query<T> query; if (bean.getQueryType() == QueryType.GROUP) { query = (Query<T>) new UpdateNodeDataQuery((QueryResultSet<GroupPage>) mergeResultSet); } else { query = new Query<T>() { @Override public T getQueryResult() { return mergeResultSet; } }; } return PostQueryBuilder.buildQuery(query, postQueryInfoList); }  }
QueryBuilder { public static <T extends QueryResultSet<?>> Query<T> buildPostQuery(final T mergeResultSet, QueryBean bean) { List<PostQueryInfo> postQueryInfoList = QueryInfoParser.parsePostQuery((QueryInfoBean) bean); Query<T> query; if (bean.getQueryType() == QueryType.GROUP) { query = (Query<T>) new UpdateNodeDataQuery((QueryResultSet<GroupPage>) mergeResultSet); } else { query = new Query<T>() { @Override public T getQueryResult() { return mergeResultSet; } }; } return PostQueryBuilder.buildQuery(query, postQueryInfoList); }  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> buildPostQuery(final T mergeResultSet, QueryBean bean) { List<PostQueryInfo> postQueryInfoList = QueryInfoParser.parsePostQuery((QueryInfoBean) bean); Query<T> query; if (bean.getQueryType() == QueryType.GROUP) { query = (Query<T>) new UpdateNodeDataQuery((QueryResultSet<GroupPage>) mergeResultSet); } else { query = new Query<T>() { @Override public T getQueryResult() { return mergeResultSet; } }; } return PostQueryBuilder.buildQuery(query, postQueryInfoList); }  static Query<T> buildQuery(String queryString); static Query<T> buildQuery(QueryBean bean); static Query<T> buildPostQuery(final T mergeResultSet, QueryBean bean);  }