Skip to content

Commit 94aab38

Browse files
committed
adapt protocol buffers module to JUnit 4
1 parent f787ea4 commit 94aab38

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

google-http-client-protobuf/src/main/java/com/google/api/client/protobuf/ProtocolBuffers.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,15 @@
3737
public class ProtocolBuffers {
3838

3939
/** {@code "application/x-protobuf"} content type. */
40-
public static final String CONTENT_TYPE = "application/x-protobuf";
40+
public static final String CONTENT_TYPE;
4141

4242
/** {@code "application/x-protobuffer"} content type. */
43-
public static final String ALT_CONTENT_TYPE = "application/x-protobuffer";
43+
public static final String ALT_CONTENT_TYPE;
44+
45+
static {
46+
CONTENT_TYPE = "application/x-protobuf";
47+
ALT_CONTENT_TYPE = "application/x-protobuffer";
48+
}
4449

4550
/**
4651
* Parses protocol buffer content from an input stream (closing the input stream) into a protocol

google-http-client-protobuf/src/test/java/com/google/api/client/protobuf/ProtocolBuffersTest.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,22 @@
1414

1515
package com.google.api.client.protobuf;
1616

17+
import static org.junit.Assert.assertEquals;
18+
1719
import java.io.ByteArrayInputStream;
18-
import junit.framework.TestCase;
20+
import org.junit.Test;
21+
import org.junit.runner.RunWith;
22+
import org.junit.runners.JUnit4;
1923

2024
/**
2125
* Tests {@link ProtocolBuffers}.
2226
*
2327
* @author Yaniv Inbar
2428
*/
25-
public class ProtocolBuffersTest extends TestCase {
29+
@RunWith(JUnit4.class)
30+
public class ProtocolBuffersTest {
2631

32+
@Test
2733
public void testParseAndClose() throws Exception {
2834
SimpleProto.TestMessage mockResponse =
2935
SimpleProto.TestMessage.newBuilder()

0 commit comments

Comments
 (0)