Upgrade to Protobuf Java Format 1.4
Issue: SPR-14171
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -31,9 +31,9 @@ import org.springframework.protobuf.SecondMsg;
|
||||
import static org.junit.Assert.*;
|
||||
import static org.mockito.Mockito.*;
|
||||
|
||||
|
||||
/**
|
||||
* Test suite for {@link ProtobufHttpMessageConverter}
|
||||
* Test suite for {@link ProtobufHttpMessageConverter}.
|
||||
*
|
||||
* @author Alex Antonov
|
||||
*/
|
||||
public class ProtobufHttpMessageConverterTests {
|
||||
@@ -52,6 +52,7 @@ public class ProtobufHttpMessageConverterTests {
|
||||
this.testMsg = Msg.newBuilder().setFoo("Foo").setBlah(SecondMsg.newBuilder().setBlah(123).build()).build();
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void extensionRegistryInitialized() {
|
||||
verify(this.registryInitializer, times(1)).initializeExtensionRegistry(anyObject());
|
||||
@@ -74,6 +75,7 @@ public class ProtobufHttpMessageConverterTests {
|
||||
assertTrue(this.converter.canRead(Msg.class, MediaType.APPLICATION_JSON));
|
||||
assertTrue(this.converter.canRead(Msg.class, MediaType.APPLICATION_XML));
|
||||
assertTrue(this.converter.canRead(Msg.class, MediaType.TEXT_PLAIN));
|
||||
|
||||
// only supported as an output format
|
||||
assertFalse(this.converter.canRead(Msg.class, MediaType.TEXT_HTML));
|
||||
}
|
||||
@@ -115,9 +117,11 @@ public class ProtobufHttpMessageConverterTests {
|
||||
Message result = Msg.parseFrom(outputMessage.getBodyAsBytes());
|
||||
assertEquals(this.testMsg, result);
|
||||
|
||||
String messageHeader = outputMessage.getHeaders().getFirst(ProtobufHttpMessageConverter.X_PROTOBUF_MESSAGE_HEADER);
|
||||
String messageHeader =
|
||||
outputMessage.getHeaders().getFirst(ProtobufHttpMessageConverter.X_PROTOBUF_MESSAGE_HEADER);
|
||||
assertEquals("Msg", messageHeader);
|
||||
String schemaHeader = outputMessage.getHeaders().getFirst(ProtobufHttpMessageConverter.X_PROTOBUF_SCHEMA_HEADER);
|
||||
String schemaHeader =
|
||||
outputMessage.getHeaders().getFirst(ProtobufHttpMessageConverter.X_PROTOBUF_SCHEMA_HEADER);
|
||||
assertEquals("sample.proto", schemaHeader);
|
||||
}
|
||||
|
||||
@@ -133,4 +137,5 @@ public class ProtobufHttpMessageConverterTests {
|
||||
this.converter.write(this.testMsg, contentType, outputMessage);
|
||||
assertEquals(-1, outputMessage.getHeaders().getContentLength());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user