String file3 = "import \"file2.proto\";\n" +
"message M3 {\n" +
" required M1 a = 1;\n" +
"}";
FileDescriptorSource fileDescriptorSource = new FileDescriptorSource();
fileDescriptorSource.addProtoFile("file1.proto", file1);
fileDescriptorSource.addProtoFile("file2.proto", file2);
fileDescriptorSource.addProtoFile("file3.proto", file3);
Map<String, FileDescriptor> descriptors = parseAndResolve(fileDescriptorSource);
assertEquals(3, descriptors.size());
assertTrue(descriptors.containsKey("file1.proto"));
assertTrue(descriptors.containsKey("file2.proto"));