blob: 05f68570e604eb8f56ed9b7ad52680a00c8cd681 (
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
|
// Copyright 2017 Yahoo Holdings. 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.hamcrest.CoreMatchers.*;
import static org.junit.Assert.*;
/**
* @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();
assertThat(type, equalTo(clonedType));
assertThat(type, not(sameInstance(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());
}
}
}
|