# Mocking WorkflowQueue Capacity for Testing

**URL:** <https://community.temporal.io/t/mocking-workflowqueue-capacity-for-testing/17443>\
**Category:** Community Support\
**Tags:** java-sdk, testing\
**Created:** [May 15, 2025, 5:16pm UTC](https://community.temporal.io/t/mocking-workflowqueue-capacity-for-testing/17443 "2025-05-15T17:16:55Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bilal\_Fares](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/bilal_fares/32/4546_2.png) [@Bilal\_Fares](https://community.temporal.io/u/Bilal_Fares)\
**Post date:** [May 15, 2025, 5:16pm UTC](https://community.temporal.io/t/mocking-workflowqueue-capacity-for-testing/17443/1 "2025-05-15T17:16:55Z")

</div>

Hello,  
I’m working on testing a workflow that uses `WorkflowQueue` with a capacity limit, and I’m looking for guidance on how to properly mock this in my tests.  
So in my workflow, I’m creating a queue with:

```auto
    private final WorkflowQueue<QueueType> myQueue= Workflow.newWorkflowQueue(1000);

```

And this queue is being populated through an update method that receives user requests. When the queue reaches capacity, I’m throwing an ApplicationFailure to notify the user and I want to test this behavior.  
So what I need is the capability to mock the queue’s capacity to simulate a full queue scenario in my tests. However, I haven’t been able to find appropriate methods in the workflow interceptor classes that would allow mocking `Workflow.newWorkflowQueue()` or control the returned queue’s behavior.

## Questions

1. Is there a recommended way to mock the created `WorkflowQueue`?
2. Are there any examples for testing such scenarios because I couldn’t find any?

Thank you!

---

<div class="post-metadata">

**Author:** ![maxim](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/maxim/32/8_2.png) [@maxim](https://community.temporal.io/u/maxim)\
**Post date:** [May 15, 2025, 11:19pm UTC](https://community.temporal.io/t/mocking-workflowqueue-capacity-for-testing/17443/2 "2025-05-15T23:19:06Z")

</div>

Why do you need to mock the queue? I would send more than 1k updates in the unit test to exceed the real production limit.
