Map<String, List<Phase2Context>> groupedByResourceId(List<Phase2Context> contexts) {
        Map<String, List<Phase2Context>> groupedContexts = new HashMap<>(DEFAULT_RESOURCE_SIZE);
        contexts.forEach(context -> {
            if (StringUtils.isBlank(context.resourceId)) {
                LOGGER.warn("resourceId is empty, resource:{}", context);
                return;
            }
            List<Phase2Context> group = groupedContexts.computeIfAbsent(context.resourceId, key -> new LinkedList<>());
            group.add(context);
        });
        return groupedContexts;
    }
@Test
    void groupedByResourceId() {
        List<AsyncWorker.Phase2Context> contexts = getRandomContexts();
        Map<String, List<AsyncWorker.Phase2Context>> groupedContexts = worker.groupedByResourceId(contexts);
        groupedContexts.forEach((resourceId, group) -> group.forEach(context -> {
            String message = "each context in the group should has the same resourceId";
            assertEquals(resourceId, context.resourceId, message);
        }));
    }