本文整理汇总了Java中uk.gov.gchq.koryphe.impl.predicate.IsA类的典型用法代码示例。如果您正苦于以下问题:Java IsA类的具体用法?Java IsA怎么用?Java IsA使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IsA类属于uk.gov.gchq.koryphe.impl.predicate包,在下文中一共展示了IsA类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: shouldDeserialiseFromSimpleClassName
import uk.gov.gchq.koryphe.impl.predicate.IsA; //导入依赖的package包/类
@Test
public void shouldDeserialiseFromSimpleClassName() throws IOException, ClassNotFoundException {
// Given
final SimpleClassKeyDeserializer deserialiser = new SimpleClassKeyDeserializer();
final DeserializationContext context = mock(DeserializationContext.class);
final Class expectedClass = IsA.class;
final String id = expectedClass.getSimpleName();
given(context.findClass(expectedClass.getName())).willReturn(expectedClass);
// When
final Class<?> clazz = (Class<?>) deserialiser.deserializeKey(id, context);
// Then
assertEquals(expectedClass, clazz);
verify(context).findClass(expectedClass.getName());
}
示例2: shouldDeserialiseFromSimpleClassName
import uk.gov.gchq.koryphe.impl.predicate.IsA; //导入依赖的package包/类
@Test
public void shouldDeserialiseFromSimpleClassName() throws IOException, ClassNotFoundException {
// Given
final SimpleClassDeserializer deserialiser = new SimpleClassDeserializer();
final DeserializationContext context = mock(DeserializationContext.class);
final Class expectedClass = IsA.class;
final String id = expectedClass.getSimpleName();
given(context.findClass(expectedClass.getName())).willReturn(expectedClass);
// When
final Class<?> clazz = deserialiser._deserialize(id, context);
// Then
assertEquals(expectedClass, clazz);
verify(context).findClass(expectedClass.getName());
}
示例3: shouldDeserialiseFromFullClassName
import uk.gov.gchq.koryphe.impl.predicate.IsA; //导入依赖的package包/类
@Test
public void shouldDeserialiseFromFullClassName() throws IOException, ClassNotFoundException {
// Given
final SimpleClassDeserializer deserialiser = new SimpleClassDeserializer();
final DeserializationContext context = mock(DeserializationContext.class);
final Class expectedClass = IsA.class;
final String id = expectedClass.getName();
given(context.findClass(expectedClass.getName())).willReturn(expectedClass);
// When
final Class<?> clazz = deserialiser._deserialize(id, context);
// Then
assertEquals(expectedClass, clazz);
verify(context).findClass(expectedClass.getName());
}
示例4: isAString
import uk.gov.gchq.koryphe.impl.predicate.IsA; //导入依赖的package包/类
public void isAString() {
// ---------------------------------------------------------
final IsA function = new IsA(String.class);
// ---------------------------------------------------------
runExample(function,
null,
1, 2.5, "abc");
}
示例5: isANumber
import uk.gov.gchq.koryphe.impl.predicate.IsA; //导入依赖的package包/类
public void isANumber() {
// ---------------------------------------------------------
final IsA function = new IsA(Number.class);
// ---------------------------------------------------------
runExample(function,
null,
1, 2.5, "abc");
}
示例6: shouldJsonSerialiseAndDeserialise
import uk.gov.gchq.koryphe.impl.predicate.IsA; //导入依赖的package包/类
@Test
public void shouldJsonSerialiseAndDeserialise() throws IOException {
// Given
final PredicateMap<String> mapFilter = new PredicateMap<>(DATE_KEY, new IsA(Map.class));
// When
final String json = JsonSerialiser.serialise(mapFilter);
// Then
JsonSerialiser.assertEquals(String.format("{\n" +
" \"class\" : \"uk.gov.gchq.koryphe.predicate.PredicateMap\",\n" +
" \"predicate\" : {\n" +
" \"class\" : \"uk.gov.gchq.koryphe.impl.predicate.IsA\",\n" +
" \"type\" : \"java.util.Map\"\n" +
" },\n" +
" \"key\" : {\n" +
" \"java.util.Date\" : " + DATE_KEY.getTime() + "%n" +
" }\n" +
"}"), json);
// When 2
final PredicateMap deserialisedFilter = JsonSerialiser.deserialise(json, PredicateMap.class);
// Then 2
assertNotNull(deserialisedFilter);
assertEquals(DATE_KEY, deserialisedFilter.getKey());
}
示例7: shouldDeserialiseFromFullClassName
import uk.gov.gchq.koryphe.impl.predicate.IsA; //导入依赖的package包/类
@Test
public void shouldDeserialiseFromFullClassName() throws IOException, ClassNotFoundException {
// Given
final SimpleClassKeyDeserializer deserialiser = new SimpleClassKeyDeserializer();
final DeserializationContext context = mock(DeserializationContext.class);
final Class expectedClass = IsA.class;
final String id = expectedClass.getName();
given(context.findClass(expectedClass.getName())).willReturn(expectedClass);
// When
final Class<?> clazz = (Class<?>) deserialiser.deserializeKey(id, context);
// Then
assertEquals(expectedClass, clazz);
verify(context).findClass(expectedClass.getName());
}
示例8: shouldSerialiseToSimpleClassName
import uk.gov.gchq.koryphe.impl.predicate.IsA; //导入依赖的package包/类
@Test
public void shouldSerialiseToSimpleClassName() throws IOException, ClassNotFoundException {
// Given
SimpleClassNameCache.setUseFullNameForSerialisation(false);
final SimpleClassSerializer serialiser = new SimpleClassSerializer();
final JsonGenerator jgen = mock(JsonGenerator.class);
final Class clazz = IsA.class;
// When
serialiser.serialize(clazz, jgen, null);
// Then
verify(jgen).writeString(clazz.getSimpleName());
}
示例9: shouldSerialiseToFullClassName
import uk.gov.gchq.koryphe.impl.predicate.IsA; //导入依赖的package包/类
@Test
public void shouldSerialiseToFullClassName() throws IOException, ClassNotFoundException {
// Given
SimpleClassNameCache.setUseFullNameForSerialisation(true);
final SimpleClassSerializer serialiser = new SimpleClassSerializer();
final JsonGenerator jgen = mock(JsonGenerator.class);
final Class clazz = IsA.class;
// When
serialiser.serialize(clazz, jgen, null);
// Then
verify(jgen).writeString(clazz.getName());
}
示例10: shouldSerialiseToSimpleClassName
import uk.gov.gchq.koryphe.impl.predicate.IsA; //导入依赖的package包/类
@Test
public void shouldSerialiseToSimpleClassName() throws IOException, ClassNotFoundException {
// Given
SimpleClassNameCache.setUseFullNameForSerialisation(false);
final SimpleClassKeySerializer serialiser = new SimpleClassKeySerializer();
final JsonGenerator jgen = mock(JsonGenerator.class);
final Class clazz = IsA.class;
// When
serialiser.serialize(clazz, jgen, null);
// Then
verify(jgen).writeFieldName(clazz.getSimpleName());
}
示例11: shouldSerialiseToFullClassName
import uk.gov.gchq.koryphe.impl.predicate.IsA; //导入依赖的package包/类
@Test
public void shouldSerialiseToFullClassName() throws IOException, ClassNotFoundException {
// Given
SimpleClassNameCache.setUseFullNameForSerialisation(true);
final SimpleClassKeySerializer serialiser = new SimpleClassKeySerializer();
final JsonGenerator jgen = mock(JsonGenerator.class);
final Class clazz = IsA.class;
// When
serialiser.serialize(clazz, jgen, null);
// Then
verify(jgen).writeFieldName(clazz.getName());
}
示例12: shouldDeserialiseFromSimpleClassName
import uk.gov.gchq.koryphe.impl.predicate.IsA; //导入依赖的package包/类
@Test
public void shouldDeserialiseFromSimpleClassName() throws IOException {
// Given
final String json = "{\"class\":\"IsA\",\"type\":\"Integer\"}";
// When
final IsA predicate = (IsA) JsonSerialiser.deserialise(json, KoryphePredicate.class);
// Then
assertEquals(Integer.class.getName(), predicate.getType());
}
示例13: shouldDeserialiseFromSimpleClassNameArray
import uk.gov.gchq.koryphe.impl.predicate.IsA; //导入依赖的package包/类
@Test
public void shouldDeserialiseFromSimpleClassNameArray() throws IOException {
// Given
final String json = "{\"class\":\"IsA\",\"type\":\"Integer[]\"}";
// When
final IsA predicate = (IsA) JsonSerialiser.deserialise(json, KoryphePredicate.class);
// Then
assertEquals(Integer[].class.getName(), predicate.getType());
}
示例14: shouldDeserialiseFromFullClassName
import uk.gov.gchq.koryphe.impl.predicate.IsA; //导入依赖的package包/类
@Test
public void shouldDeserialiseFromFullClassName() throws IOException {
// Given
final String json = "{\"class\":\"uk.gov.gchq.koryphe.impl.predicate.IsA\",\"type\":\"java.lang.Integer\"}";
// When
final IsA predicate = (IsA) JsonSerialiser.deserialise(json, KoryphePredicate.class);
// Then
assertEquals(Integer.class.getName(), predicate.getType());
}
示例15: shouldDeserialiseFromFullClassNameArray
import uk.gov.gchq.koryphe.impl.predicate.IsA; //导入依赖的package包/类
@Test
public void shouldDeserialiseFromFullClassNameArray() throws IOException {
// Given
final String json = "{\"class\":\"uk.gov.gchq.koryphe.impl.predicate.IsA\",\"type\":\"[Ljava.lang.Integer;\"}";
// When
final IsA predicate = (IsA) JsonSerialiser.deserialise(json, KoryphePredicate.class);
// Then
assertEquals(Integer[].class.getName(), predicate.getType());
}