private static FieldRequirement convertRequirement(byte value) { switch (value) { case TFieldRequirementType.REQUIRED: return FieldRequirement.REQUIRED; case TFieldRequirementType.OPTIONAL: return FieldRequirement.OPTIONAL; case TFieldRequirementType.DEFAULT: return FieldRequirement.DEFAULT; default: throw new IllegalArgumentException("unknown requirement type: " + value); } }
@Test public void testNewExceptionInfo() throws Exception { final ExceptionInfo exception = newExceptionInfo(FooServiceException.class); assertThat(exception).isEqualTo(new ExceptionInfo( FooServiceException.class.getName(), ImmutableList.of(newFieldInfo( FooServiceException.class, new FieldMetaData("stringVal", TFieldRequirementType.DEFAULT, new FieldValueMetaData(TType.STRING, false)))))); }