CException extends Exception implements CMessage<CException> { @Nonnull @Override public CExceptionDescriptor descriptor() { return descriptor; } private  CException(Builder builder); @Override Map<Integer,Object> values(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); @Override @Nonnull PMessageBuilder<CException,CField> mutate(); @Nonnull @Override CExceptionDescriptor descriptor();  }
@Test public void testDescriptor() { assertThat(descriptor.getDocumentation(), is("comment")); assertThat(descriptor.findFieldByName("text"), is(sameInstance(text))); assertThat(descriptor.findFieldById(2), is(sameInstance(num))); assertThat(descriptor.getAnnotations(), is(ImmutableSet.of())); assertThat(descriptor.hasAnnotation("boo"), is(false)); assertThat(descriptor.getAnnotationValue("boo"), is(nullValue())); assertThat(descriptor.isSimple(), is(true)); descriptor = new CExceptionDescriptor("comment", "program", "MyEx", ImmutableList.of(text, num, list), ImmutableMap.of("json.compact", "true")); assertThat(descriptor.getAnnotations(), is(ImmutableSet.of("json.compact"))); assertThat(descriptor.hasAnnotation(ThriftAnnotation.JSON_COMPACT), is(true)); assertThat(descriptor.getAnnotationValue(ThriftAnnotation.JSON_COMPACT), is("true")); assertThat(descriptor.isSimple(), is(false)); }