    /**
     * Return true if there is at least one log in the last 60 minutes.
     *
     * @return
     * @throws org.apache.accumulo.core.client.TableNotFoundException
     */
    @Path("/runningqueries/{userid}")
    @GET
    public String getRunningQueries(@PathParam("userid") String userId) throws Exception {
        DatawavePrincipal principal = getPrincipal();
        boolean isAnAdmin = isAnAdmin(principal);
        QueryImplListResponse runningQueries = null;
        if (isAnAdmin) {
            runningQueries = queryExecutor.listQueriesForUser(userId);
        } else {
            runningQueries = queryExecutor.listUserQueries();
        }

        List<Query> queryList = runningQueries.getQuery();
        List<HudQuerySummary> querySummaryList = new ArrayList<>();

        for (Query query : queryList) {
            HudQuerySummary summary = summaryBuilder.build(query);

            String queryId = query.getId().toString();

            List<? extends BaseQueryMetric> queryMetricsList;

            queryMetricsList = queryMetrics.query(queryId).getResult();

            if (queryMetricsList != null && !queryMetricsList.isEmpty()) {
                BaseQueryMetric qm = queryMetricsList.get(0);

                List<PageMetric> pageMetrics = qm.getPageTimes();
                summary.setPageMetrics(pageMetrics);

                summary.setCreateDate(qm.getCreateDate().getTime());
                summary.setNumPages(qm.getNumPages());
                summary.setNumResults(qm.getNumResults());
                summary.setLastUpdated(qm.getLastUpdated().getTime());
                summary.setLifeCycle(qm.getLifecycle().toString());
            }

            querySummaryList.add(summary);
        }
        String queryListJson = gson.toJson(querySummaryList);

        return queryListJson;
    }

    /**
     * Return true if there is at least one log in the last 60 minutes.
     *
     * @return
     * @throws org.apache.accumulo.core.client.TableNotFoundException
     */
    @Path("/runningqueries/{userid}")
    @GET
    public String getRunningQueries(@PathParam("userid") String userId) throws Exception {
        DatawavePrincipal principal = getPrincipal();
        boolean isAnAdmin = isAnAdmin(principal);
        QueryImplListResponse runningQueries = null;
        if (isAnAdmin) {
            runningQueries = queryExecutor.listQueriesForUser(userId);
        } else {
            runningQueries = queryExecutor.listUserQueries();
        }

        List<Query> queryList = runningQueries.getQuery();
        List<HudQuerySummary> querySummaryList = new ArrayList<HudQuerySummary>();

        for (Query query : queryList) {
            HudQuerySummary summary = summaryBuilder.build(query);

            String queryId = query.getId().toString();

            List<? extends BaseQueryMetric> queryMetricsList;

            queryMetricsList = queryMetrics.query(queryId).getResult();

            if (queryMetricsList != null && !queryMetricsList.isEmpty()) {
                BaseQueryMetric qm = queryMetricsList.get(0);

                List<PageMetric> pageMetrics = qm.getPageTimes();
                summary.setPageMetrics(pageMetrics);

                summary.setCreateDate(qm.getCreateDate().getTime());
                summary.setNumPages(qm.getNumPages());
                summary.setNumResults(qm.getNumResults());
                summary.setLastUpdated(qm.getLastUpdated().getTime());
                summary.setLifeCycle(qm.getLifecycle().toString());
            }

            querySummaryList.add(summary);
        }
        String queryListJson = gson.toJson(querySummaryList);

        return queryListJson;
    }

Replace Generic With Diamond ArrayList<HudQuerySummary> with ArrayList<> in method public getRunningQueries(userId String) : String from class datawave.webservice.query.hud.HudBean


    @Path("/summaryall")
    @GET
    public String getSummaryQueryStats() throws Exception {
        QueryMetricsSummaryResponse summaryResp = queryMetrics.getTotalQueriesSummary(null, null);
        QueryMetricSummary hour1 = summaryResp.getHour1();
        QueryMetricSummary hour6 = summaryResp.getHour6();
        QueryMetricSummary hour12 = summaryResp.getHour12();
        QueryMetricSummary day1 = summaryResp.getDay1();

        List<HudMetricSummary> metricSummaryList = new ArrayList<>();
        metricSummaryList.add(metricSummaryBuilder.buildMetricsSummary(1L, hour1));
        metricSummaryList.add(metricSummaryBuilder.buildMetricsSummary(6L, hour6));
        metricSummaryList.add(metricSummaryBuilder.buildMetricsSummary(12L, hour12));
        metricSummaryList.add(metricSummaryBuilder.buildMetricsSummary(24L, day1));

        String metricSummaryJson = gson.toJson(metricSummaryList);
        return metricSummaryJson;
    }

    @Path("/summaryall")
    @GET
    public String getSummaryQueryStats() throws Exception {
        QueryMetricsSummaryResponse summaryResp = queryMetrics.getTotalQueriesSummary(null, null);
        QueryMetricSummary hour1 = summaryResp.getHour1();
        QueryMetricSummary hour6 = summaryResp.getHour6();
        QueryMetricSummary hour12 = summaryResp.getHour12();
        QueryMetricSummary day1 = summaryResp.getDay1();

        List<HudMetricSummary> metricSummaryList = new ArrayList<HudMetricSummary>();
        metricSummaryList.add(metricSummaryBuilder.buildMetricsSummary(1L, hour1));
        metricSummaryList.add(metricSummaryBuilder.buildMetricsSummary(6L, hour6));
        metricSummaryList.add(metricSummaryBuilder.buildMetricsSummary(12L, hour12));
        metricSummaryList.add(metricSummaryBuilder.buildMetricsSummary(24L, day1));

        String metricSummaryJson = gson.toJson(metricSummaryList);
        return metricSummaryJson;
    }

Replace Generic With Diamond ArrayList<HudMetricSummary> with ArrayList<> in method public getSummaryQueryStats() : String from class datawave.webservice.query.hud.HudBean


    /**
     * @param otherPageMetrics
     *            the pageMetrics to set
     */
    public void setPageMetrics(List<PageMetric> otherPageMetrics) {
        this.pageMetrics = new ArrayList<>(otherPageMetrics.size());
        for (PageMetric metric : otherPageMetrics) {
            this.pageMetrics.add(metric);
        }

    }

    /**
     * @param otherPageMetrics
     *            the pageMetrics to set
     */
    public void setPageMetrics(List<PageMetric> otherPageMetrics) {
        this.pageMetrics = new ArrayList<PageMetric>(otherPageMetrics.size());
        for (PageMetric metric : otherPageMetrics) {
            this.pageMetrics.add(metric);
        }

    }

Replace Generic With Diamond ArrayList<PageMetric> with ArrayList<> in method public setPageMetrics(otherPageMetrics List<PageMetric>) : void from class datawave.webservice.query.hud.HudQuerySummary


    private EventQueryResponseBase lookupPagedContent(final String queryName, final AbstractUUIDLookupCriteria validatedCriteria,
                    final List<StringBuilder> batchedContentQueryStrings, final Date endDate, final Date expireDate, final String userAuths,
                    boolean allEventMockResponse) {
        // Initialize the return value
        EventQueryResponseBase mergedContentQueryResponse = null;

        // Call the ContentQuery for one or more events
        DatawaveWebApplicationException noResultsException = null;
        for (final StringBuilder contentQuery : batchedContentQueryStrings) {
            // Submitted query should look like this:
            //
            // DOCUMENT:shardId/datatype/uid [DOCUMENT:shardId/datatype/uid]*
            //
            MultivaluedMap<String,String> queryParameters = new MultivaluedMapImpl<>();
            queryParameters.putAll(this.defaultOptionalParams);
            queryParameters.putSingle(QueryParameters.QUERY_NAME, queryName);
            queryParameters.putSingle(QueryParameters.QUERY_STRING, contentQuery.toString());
            try {
                queryParameters.putSingle(QueryParameters.QUERY_BEGIN, QueryParametersImpl.formatDate(this.beginAsDate));
            } catch (ParseException e1) {
                throw new RuntimeException("Error formatting begin date: " + this.beginAsDate);
            }
            try {
                queryParameters.putSingle(QueryParameters.QUERY_END, QueryParametersImpl.formatDate(endDate));
            } catch (ParseException e1) {
                throw new RuntimeException("Error formatting end date: " + endDate);
            }
            queryParameters.putSingle(QueryParameters.QUERY_AUTHORIZATIONS, userAuths);
            try {
                queryParameters.putSingle(QueryParameters.QUERY_EXPIRATION, QueryParametersImpl.formatDate(expireDate));
            } catch (ParseException e1) {
                throw new RuntimeException("Error formatting expr date: " + expireDate);
            }
            queryParameters.putSingle(QueryParameters.QUERY_PERSISTENCE, QueryPersistence.TRANSIENT.name());
            queryParameters.putSingle(QueryParameters.QUERY_TRACE, "false");

            for (String key : validatedCriteria.getQueryParameters().keySet()) {
                if (!queryParameters.containsKey(key)) {
                    queryParameters.put(key, validatedCriteria.getQueryParameters().get(key));
                }
            }

            final GenericResponse<String> createResponse = this.queryExecutor.createQuery(CONTENT_QUERY, queryParameters);
            final String contentQueryId = createResponse.getResult();
            boolean preventCloseOfMergedQueryId = ((null == mergedContentQueryResponse) && allEventMockResponse);
            try {
                BaseQueryResponse contentQueryResponse = null;
                do {
                    try {
                        // Get the first/next results
                        contentQueryResponse = this.queryExecutor.next(contentQueryId);

                        // Validate the response, which also checks for null
                        if (!(contentQueryResponse instanceof EventQueryResponseBase)) {
                            EventQueryResponseBase er = responseObjectFactory.getEventQueryResponse();
                            er.addMessage("Unhandled response type " + contentQueryResponse + " from ContentQuery");
                            throw new PreConditionFailedException(null, er);
                        }

                        // Prevent NPE due to attempted merge when total events is null
                        final EventQueryResponseBase eventQueryResponse = (EventQueryResponseBase) contentQueryResponse;
                        if (null == eventQueryResponse.getTotalEvents()) {
                            final Long returnedEvents = eventQueryResponse.getReturnedEvents();
                            eventQueryResponse.setTotalEvents((null != returnedEvents) ? returnedEvents : 0L);
                        }

                        // Assign the merged response if it hasn't been done yet
                        if (null == mergedContentQueryResponse) {
                            mergedContentQueryResponse = (EventQueryResponseBase) contentQueryResponse;
                        }
                        // If the merged content has already been assigned, merge into it, but keep the original
                        // query Id
                        else {
                            final String queryId = mergedContentQueryResponse.getQueryId();
                            mergedContentQueryResponse.merge((EventQueryResponseBase) contentQueryResponse);
                            mergedContentQueryResponse.setQueryId(queryId);
                        }
                    } catch (final NoResultsException e) {
                        contentQueryResponse = null;
                        noResultsException = e;
                    }
                    // This used to be the case. Don't know when the executor started
                    // directly throwing a NoResultsException, but this is kept just
                    // in case.
                    catch (final EJBException e) {
                        final Throwable cause = e.getCause();
                        if (cause instanceof DatawaveWebApplicationException) {
                            DatawaveWebApplicationException nwae = (DatawaveWebApplicationException) cause;
                            if (nwae instanceof NoResultsException) {
                                contentQueryResponse = null;
                                noResultsException = nwae;
                            } else {
                                throw nwae;
                            }
                        }
                    }
                }
                // Loop if more results are available
                while (null != contentQueryResponse);
            } finally {
                if (!preventCloseOfMergedQueryId) {
                    this.queryExecutor.close(contentQueryId);
                }
            }
        }

        // Conditionally throw a NoResultsException
        if ((null == mergedContentQueryResponse) && (null != noResultsException)) {
            throw noResultsException;
        }

        return mergedContentQueryResponse;
    }

    private EventQueryResponseBase lookupPagedContent(final String queryName, final AbstractUUIDLookupCriteria validatedCriteria,
                    final List<StringBuilder> batchedContentQueryStrings, final Date endDate, final Date expireDate, final String userAuths,
                    boolean allEventMockResponse) {
        // Initialize the return value
        EventQueryResponseBase mergedContentQueryResponse = null;

        // Call the ContentQuery for one or more events
        DatawaveWebApplicationException noResultsException = null;
        for (final StringBuilder contentQuery : batchedContentQueryStrings) {
            // Submitted query should look like this:
            //
            // DOCUMENT:shardId/datatype/uid [DOCUMENT:shardId/datatype/uid]*
            //
            MultivaluedMap<String,String> queryParameters = new MultivaluedMapImpl<String,String>();
            queryParameters.putAll(this.defaultOptionalParams);
            queryParameters.putSingle(QueryParameters.QUERY_NAME, queryName);
            queryParameters.putSingle(QueryParameters.QUERY_STRING, contentQuery.toString());
            try {
                queryParameters.putSingle(QueryParameters.QUERY_BEGIN, QueryParametersImpl.formatDate(this.beginAsDate));
            } catch (ParseException e1) {
                throw new RuntimeException("Error formatting begin date: " + this.beginAsDate);
            }
            try {
                queryParameters.putSingle(QueryParameters.QUERY_END, QueryParametersImpl.formatDate(endDate));
            } catch (ParseException e1) {
                throw new RuntimeException("Error formatting end date: " + endDate);
            }
            queryParameters.putSingle(QueryParameters.QUERY_AUTHORIZATIONS, userAuths);
            try {
                queryParameters.putSingle(QueryParameters.QUERY_EXPIRATION, QueryParametersImpl.formatDate(expireDate));
            } catch (ParseException e1) {
                throw new RuntimeException("Error formatting expr date: " + expireDate);
            }
            queryParameters.putSingle(QueryParameters.QUERY_PERSISTENCE, QueryPersistence.TRANSIENT.name());
            queryParameters.putSingle(QueryParameters.QUERY_TRACE, "false");

            for (String key : validatedCriteria.getQueryParameters().keySet()) {
                if (!queryParameters.containsKey(key)) {
                    queryParameters.put(key, validatedCriteria.getQueryParameters().get(key));
                }
            }

            final GenericResponse<String> createResponse = this.queryExecutor.createQuery(CONTENT_QUERY, queryParameters);
            final String contentQueryId = createResponse.getResult();
            boolean preventCloseOfMergedQueryId = ((null == mergedContentQueryResponse) && allEventMockResponse);
            try {
                BaseQueryResponse contentQueryResponse = null;
                do {
                    try {
                        // Get the first/next results
                        contentQueryResponse = this.queryExecutor.next(contentQueryId);

                        // Validate the response, which also checks for null
                        if (!(contentQueryResponse instanceof EventQueryResponseBase)) {
                            EventQueryResponseBase er = responseObjectFactory.getEventQueryResponse();
                            er.addMessage("Unhandled response type " + contentQueryResponse + " from ContentQuery");
                            throw new PreConditionFailedException(null, er);
                        }

                        // Prevent NPE due to attempted merge when total events is null
                        final EventQueryResponseBase eventQueryResponse = (EventQueryResponseBase) contentQueryResponse;
                        if (null == eventQueryResponse.getTotalEvents()) {
                            final Long returnedEvents = eventQueryResponse.getReturnedEvents();
                            eventQueryResponse.setTotalEvents((null != returnedEvents) ? returnedEvents : 0L);
                        }

                        // Assign the merged response if it hasn't been done yet
                        if (null == mergedContentQueryResponse) {
                            mergedContentQueryResponse = (EventQueryResponseBase) contentQueryResponse;
                        }
                        // If the merged content has already been assigned, merge into it, but keep the original
                        // query Id
                        else {
                            final String queryId = mergedContentQueryResponse.getQueryId();
                            mergedContentQueryResponse.merge((EventQueryResponseBase) contentQueryResponse);
                            mergedContentQueryResponse.setQueryId(queryId);
                        }
                    } catch (final NoResultsException e) {
                        contentQueryResponse = null;
                        noResultsException = e;
                    }
                    // This used to be the case. Don't know when the executor started
                    // directly throwing a NoResultsException, but this is kept just
                    // in case.
                    catch (final EJBException e) {
                        final Throwable cause = e.getCause();
                        if (cause instanceof DatawaveWebApplicationException) {
                            DatawaveWebApplicationException nwae = (DatawaveWebApplicationException) cause;
                            if (nwae instanceof NoResultsException) {
                                contentQueryResponse = null;
                                noResultsException = nwae;
                            } else {
                                throw nwae;
                            }
                        }
                    }
                }
                // Loop if more results are available
                while (null != contentQueryResponse);
            } finally {
                if (!preventCloseOfMergedQueryId) {
                    this.queryExecutor.close(contentQueryId);
                }
            }
        }

        // Conditionally throw a NoResultsException
        if ((null == mergedContentQueryResponse) && (null != noResultsException)) {
            throw noResultsException;
        }

        return mergedContentQueryResponse;
    }

Replace Generic With Diamond MultivaluedMapImpl<String,String> with MultivaluedMapImpl<> in method private lookupPagedContent(queryName String, validatedCriteria AbstractUUIDLookupCriteria, batchedContentQueryStrings List<StringBuilder>, endDate Date, expireDate Date, userAuths String, allEventMockResponse boolean) : EventQueryResponseBase from class datawave.webservice.query.util.LookupUUIDUtil


    private StreamingOutput lookupStreamedContent(final String queryName, final AbstractUUIDLookupCriteria validatedCriteria,
                    final List<StringBuilder> batchedContentQueryStrings, final Date endDate, final Date expireDate, final String userAuths,
                    boolean allEventMockResponse) {

        // Merge the content query strings
        final StringBuilder contentQuery = new StringBuilder();
        for (final StringBuilder contentQueryString : batchedContentQueryStrings) {
            if (contentQuery.length() > 0) {
                contentQuery.append(' ');
            }
            contentQuery.append(contentQueryString);
        }
        MultivaluedMap<String,String> queryParameters = new MultivaluedMapImpl<>();
        queryParameters.putAll(this.defaultOptionalParams);
        queryParameters.putSingle(QueryParameters.QUERY_NAME, queryName);
        queryParameters.putSingle(QueryParameters.QUERY_STRING, contentQuery.toString());
        try {
            queryParameters.putSingle(QueryParameters.QUERY_BEGIN, QueryParametersImpl.formatDate(this.beginAsDate));
        } catch (ParseException e1) {
            throw new RuntimeException("Error formatting begin date: " + this.beginAsDate);
        }
        try {
            queryParameters.putSingle(QueryParameters.QUERY_END, QueryParametersImpl.formatDate(endDate));
        } catch (ParseException e1) {
            throw new RuntimeException("Error formatting end date: " + endDate);
        }
        queryParameters.putSingle(QueryParameters.QUERY_AUTHORIZATIONS, userAuths);
        try {
            queryParameters.putSingle(QueryParameters.QUERY_EXPIRATION, QueryParametersImpl.formatDate(expireDate));
        } catch (ParseException e1) {
            throw new RuntimeException("Error formatting expr date: " + expireDate);
        }
        queryParameters.putSingle(QueryParameters.QUERY_PERSISTENCE, QueryPersistence.TRANSIENT.name());
        queryParameters.putSingle(QueryParameters.QUERY_TRACE, "false");

        for (String key : validatedCriteria.getQueryParameters().keySet()) {
            if (!queryParameters.containsKey(key)) {
                queryParameters.put(key, validatedCriteria.getQueryParameters().get(key));
            }
        }

        // Call the ContentQuery for one or more events
        final HttpHeaders headers = validatedCriteria.getStreamingOutputHeaders();
        return this.queryExecutor.execute(CONTENT_QUERY, queryParameters, headers);
    }

    private StreamingOutput lookupStreamedContent(final String queryName, final AbstractUUIDLookupCriteria validatedCriteria,
                    final List<StringBuilder> batchedContentQueryStrings, final Date endDate, final Date expireDate, final String userAuths,
                    boolean allEventMockResponse) {

        // Merge the content query strings
        final StringBuilder contentQuery = new StringBuilder();
        for (final StringBuilder contentQueryString : batchedContentQueryStrings) {
            if (contentQuery.length() > 0) {
                contentQuery.append(' ');
            }
            contentQuery.append(contentQueryString);
        }
        MultivaluedMap<String,String> queryParameters = new MultivaluedMapImpl<String,String>();
        queryParameters.putAll(this.defaultOptionalParams);
        queryParameters.putSingle(QueryParameters.QUERY_NAME, queryName);
        queryParameters.putSingle(QueryParameters.QUERY_STRING, contentQuery.toString());
        try {
            queryParameters.putSingle(QueryParameters.QUERY_BEGIN, QueryParametersImpl.formatDate(this.beginAsDate));
        } catch (ParseException e1) {
            throw new RuntimeException("Error formatting begin date: " + this.beginAsDate);
        }
        try {
            queryParameters.putSingle(QueryParameters.QUERY_END, QueryParametersImpl.formatDate(endDate));
        } catch (ParseException e1) {
            throw new RuntimeException("Error formatting end date: " + endDate);
        }
        queryParameters.putSingle(QueryParameters.QUERY_AUTHORIZATIONS, userAuths);
        try {
            queryParameters.putSingle(QueryParameters.QUERY_EXPIRATION, QueryParametersImpl.formatDate(expireDate));
        } catch (ParseException e1) {
            throw new RuntimeException("Error formatting expr date: " + expireDate);
        }
        queryParameters.putSingle(QueryParameters.QUERY_PERSISTENCE, QueryPersistence.TRANSIENT.name());
        queryParameters.putSingle(QueryParameters.QUERY_TRACE, "false");

        for (String key : validatedCriteria.getQueryParameters().keySet()) {
            if (!queryParameters.containsKey(key)) {
                queryParameters.put(key, validatedCriteria.getQueryParameters().get(key));
            }
        }

        // Call the ContentQuery for one or more events
        final HttpHeaders headers = validatedCriteria.getStreamingOutputHeaders();
        return this.queryExecutor.execute(CONTENT_QUERY, queryParameters, headers);
    }

Replace Generic With Diamond MultivaluedMapImpl<String,String> with MultivaluedMapImpl<> in method private lookupStreamedContent(queryName String, validatedCriteria AbstractUUIDLookupCriteria, batchedContentQueryStrings List<StringBuilder>, endDate Date, expireDate Date, userAuths String, allEventMockResponse boolean) : StreamingOutput from class datawave.webservice.query.util.LookupUUIDUtil


    private void mergeNextUUIDLookups(final EventQueryResponseBase mergedResponse) {
        // Get the query ID in order to perform the next(queryID) operations
        final String queryId = mergedResponse.getQueryId();

        // Initialize a list to collect all queried events
        final List<EventBase> mergedEvents = new LinkedList<>(mergedResponse.getEvents());

        // Get each set of next events, remove irrelevant information, and merge them into the main response
        try {
            EventQueryResponseBase eventResponse = null;
            do {
                final BaseQueryResponse nextResponse = this.queryExecutor.next(queryId);
                eventResponse = this.validatePagedResponse(nextResponse);
                final List<EventBase> nextEvents = this.removeIrrelevantEventInformation(eventResponse.getEvents());
                mergedEvents.addAll(nextEvents);
            } while (null != eventResponse);
        } catch (final NoResultsException e) {
            // No op
        } finally {
            try {
                this.queryExecutor.close(queryId);
            } catch (final Exception e) {
                final String message = "Unable to close UUID lookup query " + queryId + " while performing a content lookup";
                log.error(message, e);
            }
        }

        // Apply the merged fields back to the merged response
        mergedResponse.setEvents(mergedEvents);
    }

    private void mergeNextUUIDLookups(final EventQueryResponseBase mergedResponse) {
        // Get the query ID in order to perform the next(queryID) operations
        final String queryId = mergedResponse.getQueryId();

        // Initialize a list to collect all queried events
        final List<EventBase> mergedEvents = new LinkedList<EventBase>(mergedResponse.getEvents());

        // Get each set of next events, remove irrelevant information, and merge them into the main response
        try {
            EventQueryResponseBase eventResponse = null;
            do {
                final BaseQueryResponse nextResponse = this.queryExecutor.next(queryId);
                eventResponse = this.validatePagedResponse(nextResponse);
                final List<EventBase> nextEvents = this.removeIrrelevantEventInformation(eventResponse.getEvents());
                mergedEvents.addAll(nextEvents);
            } while (null != eventResponse);
        } catch (final NoResultsException e) {
            // No op
        } finally {
            try {
                this.queryExecutor.close(queryId);
            } catch (final Exception e) {
                final String message = "Unable to close UUID lookup query " + queryId + " while performing a content lookup";
                log.error(message, e);
            }
        }

        // Apply the merged fields back to the merged response
        mergedResponse.setEvents(mergedEvents);
    }

Replace Generic With Diamond LinkedList<EventBase> with LinkedList<> in method private mergeNextUUIDLookups(mergedResponse EventQueryResponseBase) : void from class datawave.webservice.query.util.LookupUUIDUtil


    private List<EventBase> removeIrrelevantEventInformation(final List<EventBase> events) {
        final List<EventBase> guttedEvents;
        if (null != events) {
            guttedEvents = events;
            for (final EventBase event : events) {
                if (null != event) {
                    event.setFields(EMPTY_FIELDS);
                }
            }
        } else {
            guttedEvents = new ArrayList<>(0);
        }

        return guttedEvents;
    }

    private List<EventBase> removeIrrelevantEventInformation(final List<EventBase> events) {
        final List<EventBase> guttedEvents;
        if (null != events) {
            guttedEvents = events;
            for (final EventBase event : events) {
                if (null != event) {
                    event.setFields(EMPTY_FIELDS);
                }
            }
        } else {
            guttedEvents = new ArrayList<EventBase>(0);
        }

        return guttedEvents;
    }

Replace Generic With Diamond ArrayList<EventBase> with ArrayList<> in method private removeIrrelevantEventInformation(events List<EventBase>) : List<EventBase> from class datawave.webservice.query.util.LookupUUIDUtil


    @Test
    public void testConstructor_Copy() throws Exception {
        // Set expectations
        expect(this.copy.getMarkingFunctions()).andReturn(null);
        expect(this.copy.getResponseObjectFactory()).andReturn(null);
        expect(this.copy.getLogicName()).andReturn("logicName");
        expect(this.copy.getLogicDescription()).andReturn("logicDescription");
        expect(this.copy.getAuditType(null)).andReturn(Auditor.AuditType.ACTIVE);
        expect(this.copy.getTableName()).andReturn("tableName");
        expect(this.copy.getMaxResults()).andReturn(Long.MAX_VALUE);
        expect(this.copy.getMaxRowsToScan()).andReturn(10L);
        expect(this.copy.getUndisplayedVisibilities()).andReturn(new HashSet<>());
        expect(this.copy.getMaxPageSize()).andReturn(25);
        expect(this.copy.getPageByteTrigger()).andReturn(1024L);
        expect(this.copy.getCollectQueryMetrics()).andReturn(false);
        expect(this.copy.getConnPoolName()).andReturn("connPool1");
        expect(this.copy.getBaseIteratorPriority()).andReturn(100);
        expect(this.copy.getPrincipal()).andReturn(null);
        RoleManager roleManager = new EasyRoleManager();
        expect(this.copy.getRoleManager()).andReturn(roleManager);
        expect(this.copy.getMarkingFunctions()).andReturn(null);
        expect(this.copy.getResponseObjectFactory()).andReturn(null);
        expect(this.copy.getSelectorExtractor()).andReturn(null);
        expect(this.copy.isBypassAccumulo()).andReturn(false);

        // Run the test
        PowerMock.replayAll();
        BaseQueryLogic<Object> subject = new TestQueryLogic<>(this.copy);
        int result1 = subject.getMaxPageSize();
        long result2 = subject.getPageByteTrigger();
        TransformIterator result3 = subject.getTransformIterator(this.query);
        PowerMock.verifyAll();

        // Verify results
        assertTrue("Incorrect max page size", result1 == 25);
        assertTrue("Incorrect page byte trigger", result2 == 1024L);
        assertTrue("Iterator should not be null", null != result3);
    }

    @Test
    public void testConstructor_Copy() throws Exception {
        // Set expectations
        expect(this.copy.getMarkingFunctions()).andReturn(null);
        expect(this.copy.getResponseObjectFactory()).andReturn(null);
        expect(this.copy.getLogicName()).andReturn("logicName");
        expect(this.copy.getLogicDescription()).andReturn("logicDescription");
        expect(this.copy.getAuditType(null)).andReturn(Auditor.AuditType.ACTIVE);
        expect(this.copy.getTableName()).andReturn("tableName");
        expect(this.copy.getMaxResults()).andReturn(Long.MAX_VALUE);
        expect(this.copy.getMaxRowsToScan()).andReturn(10L);
        expect(this.copy.getUndisplayedVisibilities()).andReturn(new HashSet<String>());
        expect(this.copy.getMaxPageSize()).andReturn(25);
        expect(this.copy.getPageByteTrigger()).andReturn(1024L);
        expect(this.copy.getCollectQueryMetrics()).andReturn(false);
        expect(this.copy.getConnPoolName()).andReturn("connPool1");
        expect(this.copy.getBaseIteratorPriority()).andReturn(100);
        expect(this.copy.getPrincipal()).andReturn(null);
        RoleManager roleManager = new EasyRoleManager();
        expect(this.copy.getRoleManager()).andReturn(roleManager);
        expect(this.copy.getMarkingFunctions()).andReturn(null);
        expect(this.copy.getResponseObjectFactory()).andReturn(null);
        expect(this.copy.getSelectorExtractor()).andReturn(null);
        expect(this.copy.isBypassAccumulo()).andReturn(false);

        // Run the test
        PowerMock.replayAll();
        BaseQueryLogic<Object> subject = new TestQueryLogic<>(this.copy);
        int result1 = subject.getMaxPageSize();
        long result2 = subject.getPageByteTrigger();
        TransformIterator result3 = subject.getTransformIterator(this.query);
        PowerMock.verifyAll();

        // Verify results
        assertTrue("Incorrect max page size", result1 == 25);
        assertTrue("Incorrect page byte trigger", result2 == 1024L);
        assertTrue("Iterator should not be null", null != result3);
    }

Replace Generic With Diamond HashSet<String> with HashSet<> in method public testConstructor_Copy() : void from class datawave.webservice.query.configuration.TestBaseQueryLogic


    @Test
    public void testConstructor_WithConfiguredLogic() throws Exception {
        // Set expectations
        expect(this.baseQueryLogic.getTableName()).andReturn("TEST");
        expect(this.baseQueryLogic.getBaseIteratorPriority()).andReturn(100);
        expect(this.baseQueryLogic.getMaxResults()).andReturn(Long.MAX_VALUE);
        expect(this.baseQueryLogic.getMaxRowsToScan()).andReturn(1000L);
        expect(this.baseQueryLogic.getUndisplayedVisibilities()).andReturn(new HashSet<>(0));

        // Run the test
        PowerMock.replayAll();
        GenericQueryConfiguration subject = new GenericQueryConfiguration(this.baseQueryLogic) {};
        boolean result1 = subject.canRunQuery();
        PowerMock.verifyAll();

        // Verify results
        assertFalse("Query should not be runnable", result1);
    }

    @Test
    public void testConstructor_WithConfiguredLogic() throws Exception {
        // Set expectations
        expect(this.baseQueryLogic.getTableName()).andReturn("TEST");
        expect(this.baseQueryLogic.getBaseIteratorPriority()).andReturn(100);
        expect(this.baseQueryLogic.getMaxResults()).andReturn(Long.MAX_VALUE);
        expect(this.baseQueryLogic.getMaxRowsToScan()).andReturn(1000L);
        expect(this.baseQueryLogic.getUndisplayedVisibilities()).andReturn(new HashSet<String>(0));

        // Run the test
        PowerMock.replayAll();
        GenericQueryConfiguration subject = new GenericQueryConfiguration(this.baseQueryLogic) {};
        boolean result1 = subject.canRunQuery();
        PowerMock.verifyAll();

        // Verify results
        assertFalse("Query should not be runnable", result1);
    }

Replace Generic With Diamond HashSet<String> with HashSet<> in method public testConstructor_WithConfiguredLogic() : void from class datawave.webservice.query.configuration.TestGenericQueryConfiguration


    @Test
    public void testPostProcess_BaseQueryResponse() throws Exception {
        QueryMetricsEnrichmentInterceptor subject = new QueryMetricsEnrichmentInterceptor();

        // Set expectations
        expect(responseContext.getHeaders()).andReturn(writeHeaders);
        expect(writeHeaders.keySet()).andReturn(new HashSet<>());
        expect(responseContext.getStatus()).andReturn(HttpResponseCodes.SC_OK);
        expect(responseContext.getJaxrsResponse()).andReturn(jaxrsResponse);
        expect(jaxrsResponse.getAnnotations()).andReturn(new Annotation[] {enrichQueryMetrics});
        PowerMock.mockStaticPartial(FindAnnotation.class, "findAnnotation");
        expect(FindAnnotation.findAnnotation(isA(Annotation[].class), eq(EnrichQueryMetrics.class))).andReturn(this.enrichQueryMetrics);
        expect(responseContext.getEntity()).andReturn(baseQueryResponse);
        expect(enrichQueryMetrics.methodType()).andReturn(EnrichQueryMetrics.MethodType.CREATE);
        expect(baseQueryResponse.getQueryId()).andReturn(UUID.randomUUID().toString());
        requestContext.setProperty(eq((String) Whitebox.getInternalState(subject, "RESPONSE_STATS_NAME")), anyObject());
        requestContext.setProperty(eq(QueryCall.class.getName()), isA(QueryCall.class));

        // Run the test
        PowerMock.replayAll();
        subject.filter(requestContext, responseContext);
        PowerMock.verifyAll();
    }

    @Test
    public void testPostProcess_BaseQueryResponse() throws Exception {
        QueryMetricsEnrichmentInterceptor subject = new QueryMetricsEnrichmentInterceptor();

        // Set expectations
        expect(responseContext.getHeaders()).andReturn(writeHeaders);
        expect(writeHeaders.keySet()).andReturn(new HashSet<String>());
        expect(responseContext.getStatus()).andReturn(HttpResponseCodes.SC_OK);
        expect(responseContext.getJaxrsResponse()).andReturn(jaxrsResponse);
        expect(jaxrsResponse.getAnnotations()).andReturn(new Annotation[] {enrichQueryMetrics});
        PowerMock.mockStaticPartial(FindAnnotation.class, "findAnnotation");
        expect(FindAnnotation.findAnnotation(isA(Annotation[].class), eq(EnrichQueryMetrics.class))).andReturn(this.enrichQueryMetrics);
        expect(responseContext.getEntity()).andReturn(baseQueryResponse);
        expect(enrichQueryMetrics.methodType()).andReturn(EnrichQueryMetrics.MethodType.CREATE);
        expect(baseQueryResponse.getQueryId()).andReturn(UUID.randomUUID().toString());
        requestContext.setProperty(eq((String) Whitebox.getInternalState(subject, "RESPONSE_STATS_NAME")), anyObject());
        requestContext.setProperty(eq(QueryCall.class.getName()), isA(QueryCall.class));

        // Run the test
        PowerMock.replayAll();
        subject.filter(requestContext, responseContext);
        PowerMock.verifyAll();
    }

Replace Generic With Diamond HashSet<String> with HashSet<> in method public testPostProcess_BaseQueryResponse() : void from class datawave.webservice.query.interceptor.QueryMetricsEnrichmentInterceptorTest


    @Test(expected = RuntimeException.class)
    public void testInitializeWithSameQueryLogicAndTableNames() throws Exception {

        List<BaseQueryLogic<?>> logics = new ArrayList<>();
        logics.add(new TestQueryLogic());
        logics.add(new TestQueryLogic());

        QueryImpl settings = new QueryImpl();
        settings.setPagesize(100);
        settings.setQueryAuthorizations(auths.toString());
        settings.setQuery("FOO == 'BAR'");
        settings.setParameters(new HashSet<>());
        settings.setId(UUID.randomUUID());

        CompositeQueryLogic c = new CompositeQueryLogic();
        c.setQueryLogics(logics);

        c.initialize((Connector) null, (Query) settings, Collections.singleton(auths));
    }

    @Test(expected = RuntimeException.class)
    public void testInitializeWithSameQueryLogicAndTableNames() throws Exception {

        List<BaseQueryLogic<?>> logics = new ArrayList<>();
        logics.add(new TestQueryLogic());
        logics.add(new TestQueryLogic());

        QueryImpl settings = new QueryImpl();
        settings.setPagesize(100);
        settings.setQueryAuthorizations(auths.toString());
        settings.setQuery("FOO == 'BAR'");
        settings.setParameters(new HashSet<QueryImpl.Parameter>());
        settings.setId(UUID.randomUUID());

        CompositeQueryLogic c = new CompositeQueryLogic();
        c.setQueryLogics(logics);

        c.initialize((Connector) null, (Query) settings, Collections.singleton(auths));
    }

Replace Generic With Diamond HashSet<QueryImpl.Parameter> with HashSet<> in method public testInitializeWithSameQueryLogicAndTableNames() : void from class datawave.webservice.query.logic.composite.CompositeQueryLogicTest


    @Test
    public void testInitializeWithSameQueryLogicAndDifferentTableNames() throws Exception {

        List<BaseQueryLogic<?>> logics = new ArrayList<>();
        logics.add(new TestQueryLogic() {
            @Override
            public String getTableName() {
                return "table1";
            }
        });
        logics.add(new TestQueryLogic() {
            @Override
            public String getTableName() {
                return "table2";
            }
        });

        QueryImpl settings = new QueryImpl();
        settings.setPagesize(100);
        settings.setQueryAuthorizations(auths.toString());
        settings.setQuery("FOO == 'BAR'");
        settings.setParameters(new HashSet<>());
        settings.setId(UUID.randomUUID());

        CompositeQueryLogic c = new CompositeQueryLogic();
        c.setQueryLogics(logics);

        c.initialize((Connector) null, (Query) settings, Collections.singleton(auths));
    }

    @Test
    public void testInitializeWithSameQueryLogicAndDifferentTableNames() throws Exception {

        List<BaseQueryLogic<?>> logics = new ArrayList<>();
        logics.add(new TestQueryLogic() {
            @Override
            public String getTableName() {
                return "table1";
            }
        });
        logics.add(new TestQueryLogic() {
            @Override
            public String getTableName() {
                return "table2";
            }
        });

        QueryImpl settings = new QueryImpl();
        settings.setPagesize(100);
        settings.setQueryAuthorizations(auths.toString());
        settings.setQuery("FOO == 'BAR'");
        settings.setParameters(new HashSet<QueryImpl.Parameter>());
        settings.setId(UUID.randomUUID());

        CompositeQueryLogic c = new CompositeQueryLogic();
        c.setQueryLogics(logics);

        c.initialize((Connector) null, (Query) settings, Collections.singleton(auths));
    }

Replace Generic With Diamond HashSet<QueryImpl.Parameter> with HashSet<> in method public testInitializeWithSameQueryLogicAndDifferentTableNames() : void from class datawave.webservice.query.logic.composite.CompositeQueryLogicTest


    @Test
    public void testInitialize() throws Exception {

        List<BaseQueryLogic<?>> logics = new ArrayList<>();
        logics.add(new TestQueryLogic());
        logics.add(new TestQueryLogic2());

        QueryImpl settings = new QueryImpl();
        settings.setPagesize(100);
        settings.setQueryAuthorizations(auths.toString());
        settings.setQuery("FOO == 'BAR'");
        settings.setParameters(new HashSet<>());
        settings.setId(UUID.randomUUID());

        CompositeQueryLogic c = new CompositeQueryLogic();
        c.setQueryLogics(logics);

        c.initialize((Connector) null, (Query) settings, Collections.singleton(auths));
    }

    @Test
    public void testInitialize() throws Exception {

        List<BaseQueryLogic<?>> logics = new ArrayList<>();
        logics.add(new TestQueryLogic());
        logics.add(new TestQueryLogic2());

        QueryImpl settings = new QueryImpl();
        settings.setPagesize(100);
        settings.setQueryAuthorizations(auths.toString());
        settings.setQuery("FOO == 'BAR'");
        settings.setParameters(new HashSet<QueryImpl.Parameter>());
        settings.setId(UUID.randomUUID());

        CompositeQueryLogic c = new CompositeQueryLogic();
        c.setQueryLogics(logics);

        c.initialize((Connector) null, (Query) settings, Collections.singleton(auths));
    }

Replace Generic With Diamond HashSet<QueryImpl.Parameter> with HashSet<> in method public testInitialize() : void from class datawave.webservice.query.logic.composite.CompositeQueryLogicTest


    @Test(expected = RuntimeException.class)
    public void testInitializeWithDifferentResponseTypes() throws Exception {

        List<BaseQueryLogic<?>> logics = new ArrayList<>();
        logics.add(new TestQueryLogic());
        logics.add(new DifferentTestQueryLogic());

        QueryImpl settings = new QueryImpl();
        settings.setPagesize(100);
        settings.setQueryAuthorizations(auths.toString());
        settings.setQuery("FOO == 'BAR'");
        settings.setParameters(new HashSet<>());
        settings.setId(UUID.randomUUID());

        CompositeQueryLogic c = new CompositeQueryLogic();
        c.setQueryLogics(logics);

        c.initialize((Connector) null, (Query) settings, Collections.singleton(auths));
    }

    @Test(expected = RuntimeException.class)
    public void testInitializeWithDifferentResponseTypes() throws Exception {

        List<BaseQueryLogic<?>> logics = new ArrayList<>();
        logics.add(new TestQueryLogic());
        logics.add(new DifferentTestQueryLogic());

        QueryImpl settings = new QueryImpl();
        settings.setPagesize(100);
        settings.setQueryAuthorizations(auths.toString());
        settings.setQuery("FOO == 'BAR'");
        settings.setParameters(new HashSet<QueryImpl.Parameter>());
        settings.setId(UUID.randomUUID());

        CompositeQueryLogic c = new CompositeQueryLogic();
        c.setQueryLogics(logics);

        c.initialize((Connector) null, (Query) settings, Collections.singleton(auths));
    }

Replace Generic With Diamond HashSet<QueryImpl.Parameter> with HashSet<> in method public testInitializeWithDifferentResponseTypes() : void from class datawave.webservice.query.logic.composite.CompositeQueryLogicTest


    @Test
    public void testCloseWithNoSetup() throws Exception {

        List<BaseQueryLogic<?>> logics = new ArrayList<>();
        logics.add(new TestQueryLogic());
        logics.add(new TestQueryLogic2());

        QueryImpl settings = new QueryImpl();
        settings.setPagesize(100);
        settings.setQueryAuthorizations(auths.toString());
        settings.setQuery("FOO == 'BAR'");
        settings.setParameters(new HashSet<>());
        settings.setId(UUID.randomUUID());

        CompositeQueryLogic c = new CompositeQueryLogic();
        c.setQueryLogics(logics);

        c.initialize((Connector) null, (Query) settings, Collections.singleton(auths));
        c.close();
    }

    @Test
    public void testCloseWithNoSetup() throws Exception {

        List<BaseQueryLogic<?>> logics = new ArrayList<>();
        logics.add(new TestQueryLogic());
        logics.add(new TestQueryLogic2());

        QueryImpl settings = new QueryImpl();
        settings.setPagesize(100);
        settings.setQueryAuthorizations(auths.toString());
        settings.setQuery("FOO == 'BAR'");
        settings.setParameters(new HashSet<QueryImpl.Parameter>());
        settings.setId(UUID.randomUUID());

        CompositeQueryLogic c = new CompositeQueryLogic();
        c.setQueryLogics(logics);

        c.initialize((Connector) null, (Query) settings, Collections.singleton(auths));
        c.close();
    }

Replace Generic With Diamond HashSet<QueryImpl.Parameter> with HashSet<> in method public testCloseWithNoSetup() : void from class datawave.webservice.query.logic.composite.CompositeQueryLogicTest


    @Test
    public void testCanRunQueryLogic() throws Exception {
        List<BaseQueryLogic<?>> logics = new ArrayList<>();
        TestQueryLogic logic1 = new TestQueryLogic();
        HashSet<String> roles = new HashSet<>();
        roles.add("TESTROLE");
        logic1.setRoleManager(new DatawaveRoleManager(roles));
        TestQueryLogic2 logic2 = new TestQueryLogic2();
        logic2.setRoleManager(new EasyRoleManager());
        logics.add(logic1);
        logics.add(logic2);

        CompositeQueryLogic c = new CompositeQueryLogic();
        c.setQueryLogics(logics);

        DatawaveUser u = new DatawaveUser(SubjectIssuerDNPair.of("CN=Other User Name ouser, OU=acme", "CN=ca, OU=acme"), UserType.USER, null,
                        Collections.singleton("TESTROLE"), null, 0L);
        DatawavePrincipal p = new DatawavePrincipal(Collections.singletonList(u));

        Assert.assertTrue(c.canRunQuery(p));
        Assert.assertEquals(2, c.getQueryLogics().size());
    }

    @Test
    public void testCanRunQueryLogic() throws Exception {
        List<BaseQueryLogic<?>> logics = new ArrayList<BaseQueryLogic<?>>();
        TestQueryLogic logic1 = new TestQueryLogic();
        HashSet<String> roles = new HashSet<>();
        roles.add("TESTROLE");
        logic1.setRoleManager(new DatawaveRoleManager(roles));
        TestQueryLogic2 logic2 = new TestQueryLogic2();
        logic2.setRoleManager(new EasyRoleManager());
        logics.add(logic1);
        logics.add(logic2);

        CompositeQueryLogic c = new CompositeQueryLogic();
        c.setQueryLogics(logics);

        DatawaveUser u = new DatawaveUser(SubjectIssuerDNPair.of("CN=Other User Name ouser, OU=acme", "CN=ca, OU=acme"), UserType.USER, null,
                        Collections.singleton("TESTROLE"), null, 0L);
        DatawavePrincipal p = new DatawavePrincipal(Collections.singletonList(u));

        Assert.assertTrue(c.canRunQuery(p));
        Assert.assertEquals(2, c.getQueryLogics().size());
    }

Replace Generic With Diamond ArrayList<BaseQueryLogic<?>> with ArrayList<> in method public testCanRunQueryLogic() : void from class datawave.webservice.query.logic.composite.CompositeQueryLogicTest


    @Test
    public void testCanRunQueryLogic2() throws Exception {
        List<BaseQueryLogic<?>> logics = new ArrayList<>();
        TestQueryLogic logic1 = new TestQueryLogic();
        HashSet<String> roles = new HashSet<>();
        roles.add("TESTROLE");
        logic1.setRoleManager(new DatawaveRoleManager(roles));
        TestQueryLogic2 logic2 = new TestQueryLogic2();
        HashSet<String> roles2 = new HashSet<>();
        roles2.add("NONTESTROLE");
        logic2.setRoleManager(new DatawaveRoleManager(roles2));
        logics.add(logic1);
        logics.add(logic2);

        CompositeQueryLogic c = new CompositeQueryLogic();
        c.setQueryLogics(logics);

        DatawaveUser u = new DatawaveUser(SubjectIssuerDNPair.of("CN=Other User Name ouser, OU=acme", "CN=ca, OU=acme"), UserType.USER, null,
                        Collections.singleton("TESTROLE"), null, 0L);
        DatawavePrincipal p = new DatawavePrincipal(Collections.singletonList(u));

        Assert.assertTrue(c.canRunQuery(p));
        Assert.assertEquals(1, c.getQueryLogics().size());
    }

    @Test
    public void testCanRunQueryLogic2() throws Exception {
        List<BaseQueryLogic<?>> logics = new ArrayList<BaseQueryLogic<?>>();
        TestQueryLogic logic1 = new TestQueryLogic();
        HashSet<String> roles = new HashSet<>();
        roles.add("TESTROLE");
        logic1.setRoleManager(new DatawaveRoleManager(roles));
        TestQueryLogic2 logic2 = new TestQueryLogic2();
        HashSet<String> roles2 = new HashSet<>();
        roles2.add("NONTESTROLE");
        logic2.setRoleManager(new DatawaveRoleManager(roles2));
        logics.add(logic1);
        logics.add(logic2);

        CompositeQueryLogic c = new CompositeQueryLogic();
        c.setQueryLogics(logics);

        DatawaveUser u = new DatawaveUser(SubjectIssuerDNPair.of("CN=Other User Name ouser, OU=acme", "CN=ca, OU=acme"), UserType.USER, null,
                        Collections.singleton("TESTROLE"), null, 0L);
        DatawavePrincipal p = new DatawavePrincipal(Collections.singletonList(u));

        Assert.assertTrue(c.canRunQuery(p));
        Assert.assertEquals(1, c.getQueryLogics().size());
    }

Replace Generic With Diamond ArrayList<BaseQueryLogic<?>> with ArrayList<> in method public testCanRunQueryLogic2() : void from class datawave.webservice.query.logic.composite.CompositeQueryLogicTest


    @Test
    public void testCannotRunQueryLogic2() throws Exception {
        List<BaseQueryLogic<?>> logics = new ArrayList<>();
        TestQueryLogic logic1 = new TestQueryLogic();
        HashSet<String> roles = new HashSet<>();
        roles.add("NONTESTROLE");
        logic1.setRoleManager(new DatawaveRoleManager(roles));
        TestQueryLogic2 logic2 = new TestQueryLogic2();
        HashSet<String> roles2 = new HashSet<>();
        roles2.add("NONTESTROLE");
        logic2.setRoleManager(new DatawaveRoleManager(roles2));
        logics.add(logic1);
        logics.add(logic2);

        CompositeQueryLogic c = new CompositeQueryLogic();
        c.setQueryLogics(logics);

        DatawaveUser u = new DatawaveUser(SubjectIssuerDNPair.of("CN=Other User Name ouser, OU=acme", "CN=ca, OU=acme"), UserType.USER, null,
                        Collections.singleton("TESTROLE"), null, 0L);
        DatawavePrincipal p = new DatawavePrincipal(Collections.singletonList(u));

        Assert.assertFalse(c.canRunQuery(p));
        Assert.assertEquals(0, c.getQueryLogics().size());

    }

    @Test
    public void testCannotRunQueryLogic2() throws Exception {
        List<BaseQueryLogic<?>> logics = new ArrayList<BaseQueryLogic<?>>();
        TestQueryLogic logic1 = new TestQueryLogic();
        HashSet<String> roles = new HashSet<>();
        roles.add("NONTESTROLE");
        logic1.setRoleManager(new DatawaveRoleManager(roles));
        TestQueryLogic2 logic2 = new TestQueryLogic2();
        HashSet<String> roles2 = new HashSet<>();
        roles2.add("NONTESTROLE");
        logic2.setRoleManager(new DatawaveRoleManager(roles2));
        logics.add(logic1);
        logics.add(logic2);

        CompositeQueryLogic c = new CompositeQueryLogic();
        c.setQueryLogics(logics);

        DatawaveUser u = new DatawaveUser(SubjectIssuerDNPair.of("CN=Other User Name ouser, OU=acme", "CN=ca, OU=acme"), UserType.USER, null,
                        Collections.singleton("TESTROLE"), null, 0L);
        DatawavePrincipal p = new DatawavePrincipal(Collections.singletonList(u));

        Assert.assertFalse(c.canRunQuery(p));
        Assert.assertEquals(0, c.getQueryLogics().size());

    }

Replace Generic With Diamond ArrayList<BaseQueryLogic<?>> with ArrayList<> in method public testCannotRunQueryLogic2() : void from class datawave.webservice.query.logic.composite.CompositeQueryLogicTest


    @Test
    public void testLookupUUID_happyPath() {
        UUIDType uuidType = PowerMock.createMock(UUIDType.class);
        BaseQueryResponse response = PowerMock.createMock(BaseQueryResponse.class);
        ManagedExecutorService executor = PowerMock.createMock(ManagedExecutorService.class);

        expect(uriInfo.getQueryParameters()).andReturn(new MultivaluedHashMap<>());
        expect(lookupUUIDUtil.getUUIDType("uuidType")).andReturn(uuidType);
        expect(uuidType.getDefinedView()).andReturn("abc");
        expect(lookupUUIDUtil.createUUIDQueryAndNext(isA(GetUUIDCriteria.class))).andReturn(response);
        expect(response.getQueryId()).andReturn("11111");
        expect(context.getCallerPrincipal()).andReturn(principal);
        expect(executor.submit(isA(Runnable.class))).andReturn(null);

        PowerMock.replayAll();

        QueryExecutorBean subject = new QueryExecutorBean();
        setInternalState(subject, EJBContext.class, context);
        setInternalState(subject, QueryCache.class, cache);
        setInternalState(subject, Persister.class, persister);
        setInternalState(subject, QueryLogicFactory.class, queryLogicFactory);
        setInternalState(subject, QueryExpirationConfiguration.class, queryExpirationConf);
        setInternalState(subject, AuditBean.class, auditor);
        setInternalState(subject, QueryMetricFactory.class, new QueryMetricFactoryImpl());
        setInternalState(subject, LookupUUIDUtil.class, lookupUUIDUtil);
        setInternalState(subject, ManagedExecutorService.class, executor);

        subject.lookupUUID("uuidType", "1234567890", uriInfo, httpHeaders);

        PowerMock.verifyAll();
    }

    @Test
    public void testLookupUUID_happyPath() {
        UUIDType uuidType = PowerMock.createMock(UUIDType.class);
        BaseQueryResponse response = PowerMock.createMock(BaseQueryResponse.class);
        ManagedExecutorService executor = PowerMock.createMock(ManagedExecutorService.class);

        expect(uriInfo.getQueryParameters()).andReturn(new MultivaluedHashMap<String,String>());
        expect(lookupUUIDUtil.getUUIDType("uuidType")).andReturn(uuidType);
        expect(uuidType.getDefinedView()).andReturn("abc");
        expect(lookupUUIDUtil.createUUIDQueryAndNext(isA(GetUUIDCriteria.class))).andReturn(response);
        expect(response.getQueryId()).andReturn("11111");
        expect(context.getCallerPrincipal()).andReturn(principal);
        expect(executor.submit(isA(Runnable.class))).andReturn(null);

        PowerMock.replayAll();

        QueryExecutorBean subject = new QueryExecutorBean();
        setInternalState(subject, EJBContext.class, context);
        setInternalState(subject, QueryCache.class, cache);
        setInternalState(subject, Persister.class, persister);
        setInternalState(subject, QueryLogicFactory.class, queryLogicFactory);
        setInternalState(subject, QueryExpirationConfiguration.class, queryExpirationConf);
        setInternalState(subject, AuditBean.class, auditor);
        setInternalState(subject, QueryMetricFactory.class, new QueryMetricFactoryImpl());
        setInternalState(subject, LookupUUIDUtil.class, lookupUUIDUtil);
        setInternalState(subject, ManagedExecutorService.class, executor);

        subject.lookupUUID("uuidType", "1234567890", uriInfo, httpHeaders);

        PowerMock.verifyAll();
    }

Replace Generic With Diamond MultivaluedHashMap<String,String> with MultivaluedHashMap<> in method public testLookupUUID_happyPath() : void from class datawave.webservice.query.runner.ExtendedQueryExecutorBeanTest


    @Test
    public void testLookupUUID_closeFail() {
        QueryExecutorBean subject = PowerMock.createPartialMock(QueryExecutorBean.class, "close");
        UUIDType uuidType = PowerMock.createMock(UUIDType.class);
        BaseQueryResponse response = PowerMock.createMock(BaseQueryResponse.class);
        ManagedExecutorService executor = PowerMock.createMock(ManagedExecutorService.class);

        expect(uriInfo.getQueryParameters()).andReturn(new MultivaluedHashMap<>());
        expect(lookupUUIDUtil.getUUIDType("uuidType")).andReturn(uuidType);
        expect(uuidType.getDefinedView()).andReturn("abc");
        expect(lookupUUIDUtil.createUUIDQueryAndNext(isA(GetUUIDCriteria.class))).andReturn(response);
        expect(response.getQueryId()).andReturn("11111");
        expect(context.getCallerPrincipal()).andReturn(principal);
        expect(executor.submit(isA(Runnable.class))).andThrow(new RejectedExecutionException("INTENTIONALLY THROWN TEST EXCEPTION: Async close rejected"));
        expect(subject.close("11111")).andReturn(null);

        PowerMock.replayAll();

        setInternalState(subject, EJBContext.class, context);
        setInternalState(subject, QueryCache.class, cache);
        setInternalState(subject, Persister.class, persister);
        setInternalState(subject, QueryLogicFactory.class, queryLogicFactory);
        setInternalState(subject, QueryExpirationConfiguration.class, queryExpirationConf);
        setInternalState(subject, AuditBean.class, auditor);
        setInternalState(subject, QueryMetricFactory.class, new QueryMetricFactoryImpl());
        setInternalState(subject, LookupUUIDUtil.class, lookupUUIDUtil);
        setInternalState(subject, ManagedExecutorService.class, executor);
        setInternalState(subject, Logger.class, Logger.getLogger(QueryExecutorBean.class));

        subject.lookupUUID("uuidType", "1234567890", uriInfo, httpHeaders);

        PowerMock.verifyAll();
    }

    @Test
    public void testLookupUUID_closeFail() {
        QueryExecutorBean subject = PowerMock.createPartialMock(QueryExecutorBean.class, "close");
        UUIDType uuidType = PowerMock.createMock(UUIDType.class);
        BaseQueryResponse response = PowerMock.createMock(BaseQueryResponse.class);
        ManagedExecutorService executor = PowerMock.createMock(ManagedExecutorService.class);

        expect(uriInfo.getQueryParameters()).andReturn(new MultivaluedHashMap<String,String>());
        expect(lookupUUIDUtil.getUUIDType("uuidType")).andReturn(uuidType);
        expect(uuidType.getDefinedView()).andReturn("abc");
        expect(lookupUUIDUtil.createUUIDQueryAndNext(isA(GetUUIDCriteria.class))).andReturn(response);
        expect(response.getQueryId()).andReturn("11111");
        expect(context.getCallerPrincipal()).andReturn(principal);
        expect(executor.submit(isA(Runnable.class))).andThrow(new RejectedExecutionException("INTENTIONALLY THROWN TEST EXCEPTION: Async close rejected"));
        expect(subject.close("11111")).andReturn(null);

        PowerMock.replayAll();

        setInternalState(subject, EJBContext.class, context);
        setInternalState(subject, QueryCache.class, cache);
        setInternalState(subject, Persister.class, persister);
        setInternalState(subject, QueryLogicFactory.class, queryLogicFactory);
        setInternalState(subject, QueryExpirationConfiguration.class, queryExpirationConf);
        setInternalState(subject, AuditBean.class, auditor);
        setInternalState(subject, QueryMetricFactory.class, new QueryMetricFactoryImpl());
        setInternalState(subject, LookupUUIDUtil.class, lookupUUIDUtil);
        setInternalState(subject, ManagedExecutorService.class, executor);
        setInternalState(subject, Logger.class, Logger.getLogger(QueryExecutorBean.class));

        subject.lookupUUID("uuidType", "1234567890", uriInfo, httpHeaders);

        PowerMock.verifyAll();
    }

Replace Generic With Diamond MultivaluedHashMap<String,String> with MultivaluedHashMap<> in method public testLookupUUID_closeFail() : void from class datawave.webservice.query.runner.ExtendedQueryExecutorBeanTest


    @Test(expected = DatawaveWebApplicationException.class)
    public void testCreateQuery_auditException() throws Exception {
        String queryLogicName = "queryLogicName";
        String query = "query";
        String queryName = "queryName";
        String queryVisibility = "A&B";
        long currentTime = System.currentTimeMillis();
        Date beginDate = new Date(currentTime - 5000);
        Date endDate = new Date(currentTime - 1000);
        String queryAuthorizations = "AUTH_1";
        Date expirationDate = new Date(currentTime + 999999);
        int pagesize = 10;
        QueryPersistence persistenceMode = QueryPersistence.PERSISTENT;
        boolean trace = false;
        String userName = "userName";
        String userSid = "userSid";
        String userDN = "userDN";
        SubjectIssuerDNPair userDNpair = SubjectIssuerDNPair.of(userDN);
        List<String> dnList = Collections.singletonList(userDN);
        UUID queryId = UUID.randomUUID();
        long pageNumber = 0L;

        HashMap<String,Collection<String>> authsMap = new HashMap<>();
        authsMap.put("USERDN", Arrays.asList(queryAuthorizations));
        MultivaluedMap<String,String> queryParameters = new MultivaluedMapImpl<>();
        queryParameters.putSingle(QueryParameters.QUERY_STRING, query);
        queryParameters.putSingle(QueryParameters.QUERY_NAME, queryName);
        queryParameters.putSingle(QueryParameters.QUERY_BEGIN, QueryParametersImpl.formatDate(beginDate));
        queryParameters.putSingle(QueryParameters.QUERY_END, QueryParametersImpl.formatDate(endDate));
        queryParameters.putSingle(QueryParameters.QUERY_EXPIRATION, QueryParametersImpl.formatDate(expirationDate));
        queryParameters.putSingle(QueryParameters.QUERY_AUTHORIZATIONS, queryAuthorizations);
        queryParameters.putSingle(QueryParameters.QUERY_PAGESIZE, String.valueOf(pagesize));
        queryParameters.putSingle(QueryParameters.QUERY_PERSISTENCE, persistenceMode.name());
        queryParameters.putSingle(QueryParameters.QUERY_TRACE, String.valueOf(trace));
        queryParameters.putSingle(ColumnVisibilitySecurityMarking.VISIBILITY_MARKING, queryVisibility);
        queryParameters.putSingle("valid", "param");

        expect(context.getCallerPrincipal()).andReturn(principal).anyTimes();
        expect(this.queryLogicFactory.getQueryLogic(queryLogicName, this.principal)).andReturn((QueryLogic) this.queryLogic1);
        queryLogic1.validate(queryParameters);
        expect(principal.getName()).andReturn(userName);
        expect(principal.getShortName()).andReturn(userSid);
        expect(principal.getUserDN()).andReturn(userDNpair);
        expect(principal.getDNs()).andReturn(new String[] {userDN});
        expect(this.principal.getProxyServers()).andReturn(new HashSet<>(0)).anyTimes();
        expect(this.queryLogic1.getAuditType(null)).andReturn(AuditType.ACTIVE);
        expect(this.principal.getAuthorizations()).andReturn((Collection) Arrays.asList(Arrays.asList(queryAuthorizations)));
        expect(this.queryLogic1.getMaxPageSize()).andReturn(10).anyTimes();
        expect(queryLogic1.getSelectors(null)).andReturn(null);
        expect(auditor.audit(queryParameters)).andThrow(new JMSRuntimeException("EXPECTED TESTING EXCEPTION"));
        queryLogic1.close();

        PowerMock.replayAll();

        QueryExecutorBean executor = new QueryExecutorBean();
        setInternalState(executor, EJBContext.class, context);
        setInternalState(executor, AccumuloConnectionFactory.class, connectionFactory);
        setInternalState(executor, ResponseObjectFactory.class, responseObjectFactory);
        setInternalState(executor, CreatedQueryLogicCacheBean.class, qlCache);
        setInternalState(executor, QueryCache.class, cache);
        setInternalState(executor, Persister.class, persister);
        setInternalState(executor, QueryLogicFactoryImpl.class, queryLogicFactory);
        setInternalState(executor, QueryExpirationConfiguration.class, queryExpirationConf);
        setInternalState(executor, AuditBean.class, auditor);
        setInternalState(executor, QueryMetricsBean.class, metrics);
        setInternalState(executor, Multimap.class, traceInfos);
        setInternalState(executor, SecurityMarking.class, new ColumnVisibilitySecurityMarking());
        setInternalState(executor, QueryParameters.class, new QueryParametersImpl());
        setInternalState(executor, QueryMetricFactory.class, new QueryMetricFactoryImpl());
        setInternalState(connectionRequestBean, EJBContext.class, context);
        setInternalState(executor, AccumuloConnectionRequestBean.class, connectionRequestBean);

        executor.createQuery(queryLogicName, queryParameters);

        PowerMock.verifyAll();
    }

    @Test(expected = DatawaveWebApplicationException.class)
    public void testCreateQuery_auditException() throws Exception {
        String queryLogicName = "queryLogicName";
        String query = "query";
        String queryName = "queryName";
        String queryVisibility = "A&B";
        long currentTime = System.currentTimeMillis();
        Date beginDate = new Date(currentTime - 5000);
        Date endDate = new Date(currentTime - 1000);
        String queryAuthorizations = "AUTH_1";
        Date expirationDate = new Date(currentTime + 999999);
        int pagesize = 10;
        QueryPersistence persistenceMode = QueryPersistence.PERSISTENT;
        boolean trace = false;
        String userName = "userName";
        String userSid = "userSid";
        String userDN = "userDN";
        SubjectIssuerDNPair userDNpair = SubjectIssuerDNPair.of(userDN);
        List<String> dnList = Collections.singletonList(userDN);
        UUID queryId = UUID.randomUUID();
        long pageNumber = 0L;

        HashMap<String,Collection<String>> authsMap = new HashMap<>();
        authsMap.put("USERDN", Arrays.asList(queryAuthorizations));
        MultivaluedMap<String,String> queryParameters = new MultivaluedMapImpl<>();
        queryParameters.putSingle(QueryParameters.QUERY_STRING, query);
        queryParameters.putSingle(QueryParameters.QUERY_NAME, queryName);
        queryParameters.putSingle(QueryParameters.QUERY_BEGIN, QueryParametersImpl.formatDate(beginDate));
        queryParameters.putSingle(QueryParameters.QUERY_END, QueryParametersImpl.formatDate(endDate));
        queryParameters.putSingle(QueryParameters.QUERY_EXPIRATION, QueryParametersImpl.formatDate(expirationDate));
        queryParameters.putSingle(QueryParameters.QUERY_AUTHORIZATIONS, queryAuthorizations);
        queryParameters.putSingle(QueryParameters.QUERY_PAGESIZE, String.valueOf(pagesize));
        queryParameters.putSingle(QueryParameters.QUERY_PERSISTENCE, persistenceMode.name());
        queryParameters.putSingle(QueryParameters.QUERY_TRACE, String.valueOf(trace));
        queryParameters.putSingle(ColumnVisibilitySecurityMarking.VISIBILITY_MARKING, queryVisibility);
        queryParameters.putSingle("valid", "param");

        expect(context.getCallerPrincipal()).andReturn(principal).anyTimes();
        expect(this.queryLogicFactory.getQueryLogic(queryLogicName, this.principal)).andReturn((QueryLogic) this.queryLogic1);
        queryLogic1.validate(queryParameters);
        expect(principal.getName()).andReturn(userName);
        expect(principal.getShortName()).andReturn(userSid);
        expect(principal.getUserDN()).andReturn(userDNpair);
        expect(principal.getDNs()).andReturn(new String[] {userDN});
        expect(this.principal.getProxyServers()).andReturn(new HashSet<String>(0)).anyTimes();
        expect(this.queryLogic1.getAuditType(null)).andReturn(AuditType.ACTIVE);
        expect(this.principal.getAuthorizations()).andReturn((Collection) Arrays.asList(Arrays.asList(queryAuthorizations)));
        expect(this.queryLogic1.getMaxPageSize()).andReturn(10).anyTimes();
        expect(queryLogic1.getSelectors(null)).andReturn(null);
        expect(auditor.audit(queryParameters)).andThrow(new JMSRuntimeException("EXPECTED TESTING EXCEPTION"));
        queryLogic1.close();

        PowerMock.replayAll();

        QueryExecutorBean executor = new QueryExecutorBean();
        setInternalState(executor, EJBContext.class, context);
        setInternalState(executor, AccumuloConnectionFactory.class, connectionFactory);
        setInternalState(executor, ResponseObjectFactory.class, responseObjectFactory);
        setInternalState(executor, CreatedQueryLogicCacheBean.class, qlCache);
        setInternalState(executor, QueryCache.class, cache);
        setInternalState(executor, Persister.class, persister);
        setInternalState(executor, QueryLogicFactoryImpl.class, queryLogicFactory);
        setInternalState(executor, QueryExpirationConfiguration.class, queryExpirationConf);
        setInternalState(executor, AuditBean.class, auditor);
        setInternalState(executor, QueryMetricsBean.class, metrics);
        setInternalState(executor, Multimap.class, traceInfos);
        setInternalState(executor, SecurityMarking.class, new ColumnVisibilitySecurityMarking());
        setInternalState(executor, QueryParameters.class, new QueryParametersImpl());
        setInternalState(executor, QueryMetricFactory.class, new QueryMetricFactoryImpl());
        setInternalState(connectionRequestBean, EJBContext.class, context);
        setInternalState(executor, AccumuloConnectionRequestBean.class, connectionRequestBean);

        executor.createQuery(queryLogicName, queryParameters);

        PowerMock.verifyAll();
    }

Replace Generic With Diamond HashSet<String> with HashSet<> in method public testCreateQuery_auditException() : void from class datawave.webservice.query.runner.ExtendedQueryExecutorBeanTest


    @Test(expected = DatawaveWebApplicationException.class)
    public void testReset_auditException() throws Exception {
        // Set local test input
        String authorization = "AUTH_1";
        String queryName = "queryName";
        String queryLogicName = "queryLogicName";
        String userName = "userName";
        String userDN = "userDN";
        SubjectIssuerDNPair userDNpair = SubjectIssuerDNPair.of(userDN);
        String sid = "sid";
        UUID queryId = UUID.randomUUID();

        HashMap<String,Collection<String>> authsMap = new HashMap<>();
        authsMap.put("USERDN", Arrays.asList(authorization));

        QueryImpl qp = new QueryImpl();
        qp.setQuery("someQuery");
        qp.setQueryAuthorizations(authorization);
        qp.setBeginDate(new Date());
        qp.setEndDate(new Date());
        qp.setExpirationDate(new Date());
        qp.setQueryName(queryName);
        qp.setUserDN(userDN);
        qp.setDnList(Collections.singletonList(userDN));

        MultivaluedMap<String,String> map = qp.toMap();
        map.putSingle(PrivateAuditConstants.AUDIT_TYPE, AuditType.PASSIVE.name());
        map.putSingle(PrivateAuditConstants.LOGIC_CLASS, queryLogicName);
        map.putSingle(PrivateAuditConstants.COLUMN_VISIBILITY, authorization);
        map.putSingle(PrivateAuditConstants.USER_DN, userDN);

        // Set expectations
        expect(this.context.getUserTransaction()).andReturn(this.transaction).anyTimes();
        this.transaction.begin();
        expect(this.transaction.getStatus()).andReturn(Status.STATUS_ACTIVE).anyTimes();
        expect(this.context.getCallerPrincipal()).andReturn(this.principal);
        expect(this.principal.getName()).andReturn(userName);
        expect(this.principal.getShortName()).andReturn(sid);
        expect(this.principal.getAuthorizations()).andReturn((Collection) Arrays.asList(Arrays.asList(authorization)));
        expect(this.principal.getUserDN()).andReturn(userDNpair);
        expect(this.cache.get(queryName)).andReturn(null);
        expect(this.persister.findById(queryName)).andReturn(Arrays.asList((Query) this.query));
        expect(this.query.getQueryLogicName()).andReturn(queryLogicName).anyTimes();
        expect(this.queryLogicFactory.getQueryLogic(queryLogicName, principal)).andReturn((QueryLogic) this.queryLogic1);
        expect(this.queryLogic1.getConnectionPriority()).andReturn(Priority.NORMAL);
        expect(this.query.getQueryAuthorizations()).andReturn(authorization).anyTimes();
        expect(this.queryLogic1.getCollectQueryMetrics()).andReturn(false);
        expect(this.query.getUncaughtExceptionHandler()).andReturn(exceptionHandler).anyTimes();
        expect(this.exceptionHandler.getThrowable()).andReturn(null).anyTimes();
        expect(this.query.getOwner()).andReturn(sid).anyTimes();
        expect(this.query.getId()).andReturn(queryId).anyTimes();
        expect(this.query.getQuery()).andReturn(queryName).anyTimes();
        this.cache.put(eq(queryId.toString()), isA(RunningQuery.class));
        expect(this.cache.lock(queryName)).andReturn(true);
        expect(this.queryLogic1.getAuditType(this.query)).andReturn(AuditType.PASSIVE);
        expect(this.query.getUserDN()).andReturn(userDN).anyTimes();
        expect(this.query.toMap()).andReturn(map);
        expect(this.query.getColumnVisibility()).andReturn(authorization);
        this.query.populateMetric(anyObject(QueryMetric.class));
        expect(this.queryLogic1.getSelectors(this.query)).andReturn(new ArrayList<>());
        expect(this.auditor.audit(map)).andReturn(null);
        expectLastCall().andThrow(new Exception("EXPECTED EXCEPTION IN AUDIT"));
        cache.unlock(queryName);
        transaction.commit();
        expect(this.queryLogic1.getLogicName()).andReturn(queryLogicName);

        // Run the test
        PowerMock.replayAll();

        QueryExecutorBean subject = new QueryExecutorBean();
        setInternalState(subject, EJBContext.class, context);
        setInternalState(subject, AccumuloConnectionFactory.class, connectionFactory);
        setInternalState(subject, ResponseObjectFactory.class, responseObjectFactory);
        setInternalState(subject, QueryCache.class, cache);
        setInternalState(subject, Persister.class, persister);
        setInternalState(subject, QueryLogicFactory.class, queryLogicFactory);
        setInternalState(subject, QueryExpirationConfiguration.class, queryExpirationConf);
        setInternalState(subject, AuditBean.class, auditor);
        setInternalState(subject, QueryMetricsBean.class, metrics);
        setInternalState(subject, QueryMetricFactory.class, new QueryMetricFactoryImpl());
        setInternalState(connectionRequestBean, EJBContext.class, context);
        setInternalState(subject, AccumuloConnectionRequestBean.class, connectionRequestBean);

        subject.reset(queryName);

        PowerMock.verifyAll();
    }

    @Test(expected = DatawaveWebApplicationException.class)
    public void testReset_auditException() throws Exception {
        // Set local test input
        String authorization = "AUTH_1";
        String queryName = "queryName";
        String queryLogicName = "queryLogicName";
        String userName = "userName";
        String userDN = "userDN";
        SubjectIssuerDNPair userDNpair = SubjectIssuerDNPair.of(userDN);
        String sid = "sid";
        UUID queryId = UUID.randomUUID();

        HashMap<String,Collection<String>> authsMap = new HashMap<>();
        authsMap.put("USERDN", Arrays.asList(authorization));

        QueryImpl qp = new QueryImpl();
        qp.setQuery("someQuery");
        qp.setQueryAuthorizations(authorization);
        qp.setBeginDate(new Date());
        qp.setEndDate(new Date());
        qp.setExpirationDate(new Date());
        qp.setQueryName(queryName);
        qp.setUserDN(userDN);
        qp.setDnList(Collections.singletonList(userDN));

        MultivaluedMap<String,String> map = qp.toMap();
        map.putSingle(PrivateAuditConstants.AUDIT_TYPE, AuditType.PASSIVE.name());
        map.putSingle(PrivateAuditConstants.LOGIC_CLASS, queryLogicName);
        map.putSingle(PrivateAuditConstants.COLUMN_VISIBILITY, authorization);
        map.putSingle(PrivateAuditConstants.USER_DN, userDN);

        // Set expectations
        expect(this.context.getUserTransaction()).andReturn(this.transaction).anyTimes();
        this.transaction.begin();
        expect(this.transaction.getStatus()).andReturn(Status.STATUS_ACTIVE).anyTimes();
        expect(this.context.getCallerPrincipal()).andReturn(this.principal);
        expect(this.principal.getName()).andReturn(userName);
        expect(this.principal.getShortName()).andReturn(sid);
        expect(this.principal.getAuthorizations()).andReturn((Collection) Arrays.asList(Arrays.asList(authorization)));
        expect(this.principal.getUserDN()).andReturn(userDNpair);
        expect(this.cache.get(queryName)).andReturn(null);
        expect(this.persister.findById(queryName)).andReturn(Arrays.asList((Query) this.query));
        expect(this.query.getQueryLogicName()).andReturn(queryLogicName).anyTimes();
        expect(this.queryLogicFactory.getQueryLogic(queryLogicName, principal)).andReturn((QueryLogic) this.queryLogic1);
        expect(this.queryLogic1.getConnectionPriority()).andReturn(Priority.NORMAL);
        expect(this.query.getQueryAuthorizations()).andReturn(authorization).anyTimes();
        expect(this.queryLogic1.getCollectQueryMetrics()).andReturn(false);
        expect(this.query.getUncaughtExceptionHandler()).andReturn(exceptionHandler).anyTimes();
        expect(this.exceptionHandler.getThrowable()).andReturn(null).anyTimes();
        expect(this.query.getOwner()).andReturn(sid).anyTimes();
        expect(this.query.getId()).andReturn(queryId).anyTimes();
        expect(this.query.getQuery()).andReturn(queryName).anyTimes();
        this.cache.put(eq(queryId.toString()), isA(RunningQuery.class));
        expect(this.cache.lock(queryName)).andReturn(true);
        expect(this.queryLogic1.getAuditType(this.query)).andReturn(AuditType.PASSIVE);
        expect(this.query.getUserDN()).andReturn(userDN).anyTimes();
        expect(this.query.toMap()).andReturn(map);
        expect(this.query.getColumnVisibility()).andReturn(authorization);
        this.query.populateMetric(anyObject(QueryMetric.class));
        expect(this.queryLogic1.getSelectors(this.query)).andReturn(new ArrayList<String>());
        expect(this.auditor.audit(map)).andReturn(null);
        expectLastCall().andThrow(new Exception("EXPECTED EXCEPTION IN AUDIT"));
        cache.unlock(queryName);
        transaction.commit();
        expect(this.queryLogic1.getLogicName()).andReturn(queryLogicName);

        // Run the test
        PowerMock.replayAll();

        QueryExecutorBean subject = new QueryExecutorBean();
        setInternalState(subject, EJBContext.class, context);
        setInternalState(subject, AccumuloConnectionFactory.class, connectionFactory);
        setInternalState(subject, ResponseObjectFactory.class, responseObjectFactory);
        setInternalState(subject, QueryCache.class, cache);
        setInternalState(subject, Persister.class, persister);
        setInternalState(subject, QueryLogicFactory.class, queryLogicFactory);
        setInternalState(subject, QueryExpirationConfiguration.class, queryExpirationConf);
        setInternalState(subject, AuditBean.class, auditor);
        setInternalState(subject, QueryMetricsBean.class, metrics);
        setInternalState(subject, QueryMetricFactory.class, new QueryMetricFactoryImpl());
        setInternalState(connectionRequestBean, EJBContext.class, context);
        setInternalState(subject, AccumuloConnectionRequestBean.class, connectionRequestBean);

        subject.reset(queryName);

        PowerMock.verifyAll();
    }

Replace Generic With Diamond ArrayList<String> with ArrayList<> in method public testReset_auditException() : void from class datawave.webservice.query.runner.ExtendedQueryExecutorBeanTest


    @SuppressWarnings({"unchecked", "rawtypes"})
    @Test
    public void testNext_HappyPathUsingDeprecatedConstructor() throws Exception {

        // Set local test input
        String userDN = "userDN";
        String userSid = "userSid";
        UUID queryId = UUID.randomUUID();
        String methodAuths = "AUTH_1";
        DatawaveUser user = new DatawaveUser(SubjectIssuerDNPair.of("userDN", "issuerDN"), UserType.USER, Collections.singleton(methodAuths), null, null, 0L);
        DatawavePrincipal principal = new DatawavePrincipal(Collections.singletonList(user));
        String query = "query";
        String queryLogicName = "queryLogicName";
        String queryName = "queryName";
        long currentTime = System.currentTimeMillis();
        Date beginDate = new Date(currentTime - 5000);
        Date endDate = new Date(currentTime - 1000);
        Date expirationDate = new Date(currentTime + 9999);
        String queryAuthorizations = methodAuths;
        int pageSize = 3;
        int maxPageSize = 10;
        long pageByteTrigger = 4 * 1024L;
        long maxRowsToScan = Long.MAX_VALUE;
        long maxResults = 100L;
        List<Object> resultObjects = Arrays.asList(new Object(), "resultObject1", null);

        // Set expectations
        expect(this.queryLogic.getCollectQueryMetrics()).andReturn(true);
        this.query.populateMetric(isA(QueryMetric.class));
        expect(this.query.getUncaughtExceptionHandler()).andReturn(exceptionHandler).times(5);
        expect(this.exceptionHandler.getThrowable()).andReturn(null).times(5);
        expect(this.query.getId()).andReturn(queryId).times(3);
        expect(this.query.getOwner()).andReturn(userSid);
        expect(this.query.getQuery()).andReturn(query);
        expect(this.query.getQueryLogicName()).andReturn(queryLogicName);
        expect(this.query.getQueryName()).andReturn(queryName);
        expect(this.query.getBeginDate()).andReturn(beginDate);
        expect(this.query.getEndDate()).andReturn(endDate);
        expect(this.query.getExpirationDate()).andReturn(expirationDate);
        expect(this.query.getParameters()).andReturn(new HashSet<>());
        expect(this.query.getQueryAuthorizations()).andReturn(queryAuthorizations);
        expect(this.query.getUserDN()).andReturn(userDN).times(2);
        expect(this.queryLogic.initialize(eq(this.connector), eq(this.query), isA(Set.class))).andReturn(this.genericConfiguration);
        this.queryLogic.setupQuery(this.genericConfiguration);
        expect(this.queryLogic.getTransformIterator(this.query)).andReturn(this.transformIterator);
        Iterator<Object> iterator = resultObjects.iterator();
        while (iterator.hasNext()) {
            expect(this.transformIterator.hasNext()).andReturn(iterator.hasNext());
            expect(this.transformIterator.next()).andReturn(iterator.next());
        }
        expect(this.query.getPagesize()).andReturn(pageSize).anyTimes();
        expect(this.queryLogic.getMaxPageSize()).andReturn(maxPageSize).anyTimes();
        expect(this.queryLogic.getPageByteTrigger()).andReturn(pageByteTrigger).anyTimes();
        expect(this.queryLogic.getMaxRowsToScan()).andReturn(maxRowsToScan).anyTimes();
        expect(this.queryLogic.getMaxResults()).andReturn(maxResults).anyTimes();
        expect(this.genericConfiguration.getQueryString()).andReturn(query).once();

        // Run the test
        PowerMock.replayAll();
        RunningQuery subject = new RunningQuery(this.connector, Priority.NORMAL, this.queryLogic, this.query, methodAuths, principal,
                        new QueryMetricFactoryImpl());

        ResultsPage result1 = subject.next();
        String result2 = subject.toString();
        QueryMetric.Lifecycle status = subject.getMetric().getLifecycle();
        PowerMock.verifyAll();

        // Verify results
        assertTrue("Expected a non-null page", null != result1);
        assertTrue("Expected a non-null list of results", null != result1.getResults());
        assertTrue("Expected 2 non-null items in the list of results", result1.getResults().size() == 2);
        assertTrue("Expected status to be closed", status == QueryMetric.Lifecycle.RESULTS);

        assertTrue("Expected a non-null toString() representation", null != result2);

        assertTrue("Expected lifecycle to be results", QueryMetric.Lifecycle.RESULTS == subject.getMetric().getLifecycle());

    }

    @SuppressWarnings({"unchecked", "rawtypes"})
    @Test
    public void testNext_HappyPathUsingDeprecatedConstructor() throws Exception {

        // Set local test input
        String userDN = "userDN";
        String userSid = "userSid";
        UUID queryId = UUID.randomUUID();
        String methodAuths = "AUTH_1";
        DatawaveUser user = new DatawaveUser(SubjectIssuerDNPair.of("userDN", "issuerDN"), UserType.USER, Collections.singleton(methodAuths), null, null, 0L);
        DatawavePrincipal principal = new DatawavePrincipal(Collections.singletonList(user));
        String query = "query";
        String queryLogicName = "queryLogicName";
        String queryName = "queryName";
        long currentTime = System.currentTimeMillis();
        Date beginDate = new Date(currentTime - 5000);
        Date endDate = new Date(currentTime - 1000);
        Date expirationDate = new Date(currentTime + 9999);
        String queryAuthorizations = methodAuths;
        int pageSize = 3;
        int maxPageSize = 10;
        long pageByteTrigger = 4 * 1024L;
        long maxRowsToScan = Long.MAX_VALUE;
        long maxResults = 100L;
        List<Object> resultObjects = Arrays.asList(new Object(), "resultObject1", null);

        // Set expectations
        expect(this.queryLogic.getCollectQueryMetrics()).andReturn(true);
        this.query.populateMetric(isA(QueryMetric.class));
        expect(this.query.getUncaughtExceptionHandler()).andReturn(exceptionHandler).times(5);
        expect(this.exceptionHandler.getThrowable()).andReturn(null).times(5);
        expect(this.query.getId()).andReturn(queryId).times(3);
        expect(this.query.getOwner()).andReturn(userSid);
        expect(this.query.getQuery()).andReturn(query);
        expect(this.query.getQueryLogicName()).andReturn(queryLogicName);
        expect(this.query.getQueryName()).andReturn(queryName);
        expect(this.query.getBeginDate()).andReturn(beginDate);
        expect(this.query.getEndDate()).andReturn(endDate);
        expect(this.query.getExpirationDate()).andReturn(expirationDate);
        expect(this.query.getParameters()).andReturn(new HashSet<Parameter>());
        expect(this.query.getQueryAuthorizations()).andReturn(queryAuthorizations);
        expect(this.query.getUserDN()).andReturn(userDN).times(2);
        expect(this.queryLogic.initialize(eq(this.connector), eq(this.query), isA(Set.class))).andReturn(this.genericConfiguration);
        this.queryLogic.setupQuery(this.genericConfiguration);
        expect(this.queryLogic.getTransformIterator(this.query)).andReturn(this.transformIterator);
        Iterator<Object> iterator = resultObjects.iterator();
        while (iterator.hasNext()) {
            expect(this.transformIterator.hasNext()).andReturn(iterator.hasNext());
            expect(this.transformIterator.next()).andReturn(iterator.next());
        }
        expect(this.query.getPagesize()).andReturn(pageSize).anyTimes();
        expect(this.queryLogic.getMaxPageSize()).andReturn(maxPageSize).anyTimes();
        expect(this.queryLogic.getPageByteTrigger()).andReturn(pageByteTrigger).anyTimes();
        expect(this.queryLogic.getMaxRowsToScan()).andReturn(maxRowsToScan).anyTimes();
        expect(this.queryLogic.getMaxResults()).andReturn(maxResults).anyTimes();
        expect(this.genericConfiguration.getQueryString()).andReturn(query).once();

        // Run the test
        PowerMock.replayAll();
        RunningQuery subject = new RunningQuery(this.connector, Priority.NORMAL, this.queryLogic, this.query, methodAuths, principal,
                        new QueryMetricFactoryImpl());

        ResultsPage result1 = subject.next();
        String result2 = subject.toString();
        QueryMetric.Lifecycle status = subject.getMetric().getLifecycle();
        PowerMock.verifyAll();

        // Verify results
        assertTrue("Expected a non-null page", null != result1);
        assertTrue("Expected a non-null list of results", null != result1.getResults());
        assertTrue("Expected 2 non-null items in the list of results", result1.getResults().size() == 2);
        assertTrue("Expected status to be closed", status == QueryMetric.Lifecycle.RESULTS);

        assertTrue("Expected a non-null toString() representation", null != result2);

        assertTrue("Expected lifecycle to be results", QueryMetric.Lifecycle.RESULTS == subject.getMetric().getLifecycle());

    }

Replace Generic With Diamond HashSet<Parameter> with HashSet<> in method public testNext_HappyPathUsingDeprecatedConstructor() : void from class datawave.webservice.query.runner.ExtendedRunningQueryTest