aboutsummaryrefslogtreecommitdiffstats
path: root/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/provider/DebugHandlerHelperTest.java
blob: eddc7edd5978988514d8388b25a9aa14aaa3c1eb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.node.admin.provider;

import org.junit.jupiter.api.Test;

import java.util.Map;

import static org.junit.jupiter.api.Assertions.assertEquals;

public class DebugHandlerHelperTest {
    @Test
    void trivial() {
        DebugHandlerHelper helper = new DebugHandlerHelper();
        helper.addConstant("constant-key", "constant-value");

        NodeAdminDebugHandler handler = () -> Map.of("handler-value-key", "handler-value-value");
        helper.addHandler("handler-key", handler);

        helper.addThreadSafeSupplier("supplier-key", () -> "supplier-value");

        assertEquals("{" +
                "supplier-key=supplier-value, " +
                "handler-key={handler-value-key=handler-value-value}, " +
                "constant-key=constant-value" +
                "}",
                helper.getDebugPage().toString());
    }
}