aboutsummaryrefslogtreecommitdiffstats
path: root/config/src/test/java/com/yahoo/config/subscription/UnicodeTest.java
blob: 0b0684a0fda32501a035a15cea9f78c1934e7a23 (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.UnicodeConfig;
import org.junit.Test;

import static org.junit.Assert.assertEquals;

/**
 * Tests reading of a config containing unicode characters in UTF-8
 *
 * @author Vidar Larsen
 * @author Harald Musum
 */
public class UnicodeTest {

    /**
     * Reads a config from a file which is exactly like one returned from
     * the config server given only default values for this config.
     * The parsing code is the same whether the reading happens from file
     * or from a server connection, so this tests that this config can be
     * received correctly from the server
     */
    @Test
    @SuppressWarnings("deprecation")
    public void testUnicodeConfigReading() {
        ConfigGetter<UnicodeConfig> getter = new ConfigGetter<>(UnicodeConfig.class);
        UnicodeConfig config = getter.getConfig("file:src/test/resources/configs/unicode/unicode.cfg");

        assertEquals("Hei \u00E6\u00F8\u00E5 \uBC14\uB451 \u00C6\u00D8\u00C5 hallo", config.unicodestring1());
        assertEquals("abc \u00E6\u00F8\u00E5 \u56F2\u7881 \u00C6\u00D8\u00C5 ABC", config.unicodestring2());
    }
}