Home / Function/ testRemovalFuzz() — netty Function Reference

testRemovalFuzz() — netty Function Reference

Architecture documentation for the testRemovalFuzz() function in DefaultPriorityQueueTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  4fcd3ead_e95f_552e_4a05_6362b3c18cbc["testRemovalFuzz()"]
  23b282eb_d0ea_c3c7_a597_7a1f2dd6296d["DefaultPriorityQueueTest"]
  4fcd3ead_e95f_552e_4a05_6362b3c18cbc -->|defined in| 23b282eb_d0ea_c3c7_a597_7a1f2dd6296d
  b6bcf60b_3e0d_b5a5_66f5_198b003d58f1["TestElement()"]
  4fcd3ead_e95f_552e_4a05_6362b3c18cbc -->|calls| b6bcf60b_3e0d_b5a5_66f5_198b003d58f1
  4e25103c_6e8f_a58b_a07c_3ee0c1c46f88["assertEmptyQueue()"]
  4fcd3ead_e95f_552e_4a05_6362b3c18cbc -->|calls| 4e25103c_6e8f_a58b_a07c_3ee0c1c46f88
  style 4fcd3ead_e95f_552e_4a05_6362b3c18cbc fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

common/src/test/java/io/netty/util/internal/DefaultPriorityQueueTest.java lines 151–179

    @Test
    public void testRemovalFuzz() {
        ThreadLocalRandom threadLocalRandom = ThreadLocalRandom.current();
        final int numElements = threadLocalRandom.nextInt(0, 30);
        final TestElement[] values = new TestElement[numElements];
        PriorityQueue<TestElement> queue =
                new DefaultPriorityQueue<>(TestElementComparator.INSTANCE, values.length);
        for (int i = 0; i < values.length; ++i) {
            do {
                values[i] = new TestElement(threadLocalRandom.nextInt(0, numElements * 2));
            } while (!queue.add(values[i]));
        }

        for (int i = 0; i < values.length; ++i) {
            try {
                assertTrue(queue.removeTyped(values[i]));
                assertEquals(queue.size(), values.length - (i + 1));
            } catch (Throwable cause) {
                StringBuilder sb = new StringBuilder(values.length * 2);
                sb.append("error on removal of index: ").append(i).append(" [");
                for (TestElement value : values) {
                    sb.append(value).append(" ");
                }
                sb.append("]");
                throw new AssertionError(sb.toString(), cause);
            }
        }
        assertEmptyQueue(queue);
    }

Domain

Subdomains

Frequently Asked Questions

What does testRemovalFuzz() do?
testRemovalFuzz() is a function in the netty codebase, defined in common/src/test/java/io/netty/util/internal/DefaultPriorityQueueTest.java.
Where is testRemovalFuzz() defined?
testRemovalFuzz() is defined in common/src/test/java/io/netty/util/internal/DefaultPriorityQueueTest.java at line 151.
What does testRemovalFuzz() call?
testRemovalFuzz() calls 2 function(s): TestElement, assertEmptyQueue.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free