aboutsummaryrefslogtreecommitdiffstats
path: root/vespajlib/src/test/java/com/yahoo/java7compat/UtilTest.java
blob: b2be19494bf585732879f522a6f2a1a68fb53923 (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
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.java7compat;

import org.junit.Test;
import static org.junit.Assert.assertEquals;

/**
 * @author baldersheim
 * @since 5.2
 */

public class UtilTest {

    @Test
    public void requireJava7CompatibleDoublePrinting() {
        if (Util.isJava7Compatible()) {
            assertEquals("0.004", String.valueOf(0.0040));
        }else {
            assertEquals("0.0040", String.valueOf(0.0040));
        }
        assertEquals("0.004", Util.toJava7String(0.0040) );
    }
    
    @Test
    public void nonCompatible() {
        assertEquals(Util.nonJava7CompatibleString("0.0040"), "0.004");
    }
    
}