use of com.linkedin.restli.common.test.SimpleEnum in project rest.li by linkedin.
the class TestKeyValueRecord method testCompoundKeyWithEnum.
@Test
public void testCompoundKeyWithEnum() {
CompoundKey compoundKey = new CompoundKey();
Long longKey = 1L;
compoundKey.append("longKey", longKey);
SimpleEnum simpleEnum = SimpleEnum.A;
compoundKey.append("enumKey", simpleEnum);
Map<String, CompoundKey.TypeInfo> fieldTypes = new HashMap<>();
fieldTypes.put("longKey", new CompoundKey.TypeInfo(Long.class, Long.class));
fieldTypes.put("enumKey", new CompoundKey.TypeInfo(SimpleEnum.class, String.class));
testCompoundKey(compoundKey, fieldTypes);
}
use of com.linkedin.restli.common.test.SimpleEnum in project rest.li by linkedin.
the class TestActionArgumentBuilder method getEnumParams.
private List<Parameter<?>> getEnumParams() {
EnumDataSchema simpleEnumSchema = new EnumDataSchema(new Name("com.linkedin.restli.common.test.SimpleEnum"));
simpleEnumSchema.setSymbols(Arrays.asList("A", "B", "C"), null);
return Collections.singletonList(new Parameter<>("simpleEnum", SimpleEnum.class, simpleEnumSchema, false, null, Parameter.ParamType.POST, true, new AnnotationSet(new Annotation[] {})));
}
use of com.linkedin.restli.common.test.SimpleEnum in project rest.li by linkedin.
the class TestKeyValueRecord method testEnum.
@Test
public void testEnum() {
KeyValueRecordFactory<SimpleEnum, RecordTemplateWithPrimitiveKey> factory = new KeyValueRecordFactory<>(SimpleEnum.class, null, null, null, RecordTemplateWithPrimitiveKey.class);
SimpleEnum id = SimpleEnum.A;
RecordTemplateWithPrimitiveKey mockRecordTemplate = new RecordTemplateWithPrimitiveKey();
mockRecordTemplate.setId(1L).setBody("foo");
KeyValueRecord<SimpleEnum, RecordTemplateWithPrimitiveKey> keyValueRecord = factory.create(id, mockRecordTemplate);
Assert.assertEquals(keyValueRecord.getPrimitiveKey(SimpleEnum.class), id);
Assert.assertEquals(keyValueRecord.getValue(RecordTemplateWithPrimitiveKey.class), mockRecordTemplate);
}
Aggregations