aboutsummaryrefslogtreecommitdiffstats
path: root/document/src/test/java/com/yahoo/document/update/ValueUpdateTestCase.java
blob: 2cd84047f37ce5ba87240a2eb7bb416df6d64c0b (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 Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.document.update;

import com.yahoo.document.datatypes.FieldValue;
import com.yahoo.document.datatypes.StringFieldValue;
import org.junit.Test;

import static org.junit.Assert.assertEquals;

/**
 * Test case for ValueUpdate class.
 *
 * @author Einar M R Rosenvinge
 */
public class ValueUpdateTestCase {

    @Test
    public void testUpdateSimple() {
        // We cannot test much on this level anyway, most stuff in ValueUpdate is package
        // private. Better tests exist in FieldUpdateTestCase.
        AssignValueUpdate upd = (AssignValueUpdate) ValueUpdate.createAssign(new StringFieldValue("newvalue"));

        assertEquals(ValueUpdate.ValueUpdateClassID.ASSIGN, upd.getValueUpdateClassID());

        FieldValue newValue = upd.getValue();
        assertEquals(new StringFieldValue("newvalue"), newValue);
    }

}