aboutsummaryrefslogtreecommitdiffstats
path: root/config/src/test/java/com/yahoo/config/subscription/BasicTest.java
blob: b5fa54d4cdb40d93bc493322c3cc31aac73045d3 (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
29
30
31
32
33
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.config.subscription;


import com.yahoo.foo.AppConfig;

import org.junit.Test;

import static org.junit.Assert.assertEquals;


public class BasicTest {

    @Test
    public void testSubBasic() {
        ConfigSubscriber s = new ConfigSubscriber();
        ConfigHandle<AppConfig> h = s.subscribe(AppConfig.class, "raw:times 0");
        s.nextConfig(0, false);
        AppConfig c = h.getConfig();
        assertEquals(0, c.times());
        s.close();
    }

    @Test
    public void testSubBasicGeneration() {
        ConfigSubscriber s = new ConfigSubscriber();
        ConfigHandle<AppConfig> h = s.subscribe(AppConfig.class, "raw:times 2");
        s.nextGeneration(0, false);
        AppConfig c = h.getConfig();
        assertEquals(2, c.times());
        s.close();
    }
}