aboutsummaryrefslogtreecommitdiffstats
path: root/tests/src/cgeo/geocaching/utils/UncertainPropertyTest.java
blob: 74aa6809aae0bdc2981fc7794feaf94377ea71f5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
package cgeo.geocaching.utils;

import junit.framework.TestCase;

public class UncertainPropertyTest extends TestCase {

    public static void testHigherCertaintyWins() throws Exception {
        final UncertainProperty<String> prop1 = new UncertainProperty<String>("prop1", 10);
        final UncertainProperty<String> prop2 = new UncertainProperty<String>("prop2", 20);
        assertEquals(prop2, UncertainProperty.getMergedProperty(prop1, prop2));
    }

    public static void testAvoidNull() throws Exception {
        final UncertainProperty<String> prop1 = new UncertainProperty<String>("prop1", 10);
        final UncertainProperty<String> prop2 = new UncertainProperty<String>(null, 20);
        assertEquals(prop1, UncertainProperty.getMergedProperty(prop1, prop2));
        assertEquals(prop1, UncertainProperty.getMergedProperty(prop2, prop1));
    }
}