@Test
    public void terminalNode() {
        // Given
        Range range = Range.between(0, 60 * 1000);
        TimeWindow timeWindow = new TimeWindow(range);

        // fromNode : [testApp] test-app
        Node fromNode = createNode("testApp", ServiceTypeFactory.of(1000, "WAS"));
        String fromNodeAgent = "test-app";
        // toNode : [testDatabase] test-database
        Node toNode = createNode("testDatabase", ServiceTypeFactory.of(2000, "RDB", ServiceTypeProperty.TERMINAL));
        String toNodeAgent = "test-database";
        NodeList nodeList = NodeList.of(toNode);

        Link link = new Link(LinkDirection.IN_LINK, fromNode, toNode, range);
        HistogramSlot fastSlot = toNode.getServiceType().getHistogramSchema().getFastSlot();
        HistogramSlot normalSlot = toNode.getServiceType().getHistogramSchema().getNormalSlot();
        HistogramSlot slowSlot = toNode.getServiceType().getHistogramSchema().getSlowSlot();
        // [testApp] test-app -> [testDatabase] test-database
        long fastCallCount = 200L;
        long normalCallCount = 100L;
        long slowCallCount = 75L;
        link.addInLink(createLinkCallDataMap(fromNodeAgent, fromNode.getServiceType(), toNodeAgent, toNode.getServiceType(), fastSlot, fastCallCount));
        link.addInLink(createLinkCallDataMap(fromNodeAgent, fromNode.getServiceType(), toNodeAgent, toNode.getServiceType(), normalSlot, normalCallCount));
        link.addInLink(createLinkCallDataMap(fromNodeAgent, fromNode.getServiceType(), toNodeAgent, toNode.getServiceType(), slowSlot, slowCallCount));
        LinkList linkList = LinkList.of(link);

        // When
        nodeHistogramAppender.appendNodeHistogram(timeWindow, nodeList, linkList, buildTimeoutMillis);

        // Then
        Node actualNode = nodeList.getNodeList().iterator().next();
        NodeHistogram nodeHistogram = actualNode.getNodeHistogram();
        // verify application-level histogram
        Histogram applicationHistogram = nodeHistogram.getApplicationHistogram();
        assertEquals(fastCallCount, applicationHistogram.getFastCount());
        assertEquals(normalCallCount, applicationHistogram.getNormalCount());
        assertEquals(slowCallCount, applicationHistogram.getSlowCount());
        assertEquals(fastCallCount + normalCallCount + slowCallCount, applicationHistogram.getTotalCount());
        // verify agent-level histogram
        Map<String, Histogram> agentHistogramMap = nodeHistogram.getAgentHistogramMap();
        Histogram agentHistogram = agentHistogramMap.get(toNodeAgent);
        assertEquals(fastCallCount, agentHistogram.getFastCount());
        assertEquals(normalCallCount, agentHistogram.getNormalCount());
        assertEquals(slowCallCount, agentHistogram.getSlowCount());
        assertEquals(fastCallCount + normalCallCount + slowCallCount, agentHistogram.getTotalCount());
    }
Checks histograms for a single terminal node.
<pre>
    fromNode ---> databaseNode
</pre>
web/src/test/java/com/navercorp/pinpoint/web/applicationmap/appender/histogram/NodeHistogramAppenderTest.java