blob: 9caac542f29e500f5ab10db1c333b714fbb2c6bd (
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
34
35
36
|
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.document;
import com.yahoo.document.datatypes.FieldValue;
import com.yahoo.document.datatypes.IntegerFieldValue;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotSame;
import static org.junit.Assert.fail;
/**
* @author <a href="mailto:einarmr@yahoo-inc.com">Einar M R Rosenvinge</a>
* @since 5.1.10
*/
public class NumericDataTypeTestCase {
@Test
public void basic() {
NumericDataType type = new NumericDataType("foo", 0, FieldValue.class, IntegerFieldValue.getFactory());
NumericDataType clonedType = type.clone();
assertEquals(type,clonedType);
assertNotSame(type, clonedType);
}
@Test
public void create() {
try {
new NumericDataType("foo", 0, IntegerFieldValue.class, IntegerFieldValue.getFactory()).createFieldValue(new Object());
fail();
} catch (IllegalArgumentException e) {
assertEquals("Class class java.lang.Object not applicable to an class " +
"com.yahoo.document.datatypes.IntegerFieldValue instance.", e.getMessage());
}
}
}
|