CompareWithOriginalsTest.java 文件源码

java
阅读 23 收藏 0 点赞 0 评论 0

项目:protobuf-el 作者:
/**
 * protoc custom options' UnknownFieldSet serialization is different from Java; the resulted
 * extensions are the same, but UnknownFieldSets are different, thus the invariant has been
 * violated. When the serializations become identical, the test will start failing, indicating
 * everything is alright, so the expected exception will have to be safely removed!
 */
@Test
public void unknownToExtensionsToUnknownShouldBeEqualProtoc() throws URISyntaxException,
    IOException {
  // when
  final Collection<FileDescriptor> files =
      filesBuilder.setCustomOptionsAsExtensions(false).setProtocCompatible(false)
          .addProtos(protocFdProtos).build(false).values();

  // then
  // no errors logged!
  verify(mockErrorListener, never()).validationError(anyInt(), anyInt(), anyString(),
      any(RuntimeException.class));
  verify(mockErrorListener, never()).syntaxError(any(Recognizer.class), any(), anyInt(),
      anyInt(), anyString(), any(RecognitionException.class));

  expected.expect(Throwable.class);

  for (final FileDescriptor file : files) {
    assertReserializationInvariant(file);
  }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号