Skip to content

Commit dfb48fe

Browse files
committed
Merge branch 'renovate/com.google.cloud-native-image-shared-config-1.x' of https://github.com/renovate-bot/google-http-java-client into renovate/com.google.cloud-native-image-shared-config-1.x
2 parents bf0c6b4 + fff197f commit dfb48fe

File tree

2 files changed

+33
-19
lines changed

2 files changed

+33
-19
lines changed

google-http-client-jackson2/src/test/java/com/google/api/client/json/jackson2/JacksonFactoryTest.java

Lines changed: 28 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,17 @@
1414

1515
package com.google.api.client.json.jackson2;
1616

17+
import static org.junit.Assert.assertEquals;
18+
import static org.junit.Assert.assertNotNull;
19+
import static org.junit.Assert.fail;
20+
1721
import com.google.api.client.json.JsonFactory;
1822
import com.google.api.client.json.JsonParser;
1923
import com.google.api.client.test.json.AbstractJsonFactoryTest;
2024
import com.google.api.client.util.StringUtils;
2125
import java.io.IOException;
2226
import java.util.ArrayList;
27+
import org.junit.Test;
2328

2429
/**
2530
* Tests {@link JacksonFactory}.
@@ -28,38 +33,41 @@
2833
*/
2934
public class JacksonFactoryTest extends AbstractJsonFactoryTest {
3035

31-
private static final String JSON_ENTRY_PRETTY =
32-
"{" + StringUtils.LINE_SEPARATOR + " \"title\" : \"foo\"" + StringUtils.LINE_SEPARATOR + "}";
33-
private static final String JSON_FEED_PRETTY =
34-
"{"
35-
+ StringUtils.LINE_SEPARATOR
36-
+ " \"entries\" : [ {"
37-
+ StringUtils.LINE_SEPARATOR
38-
+ " \"title\" : \"foo\""
39-
+ StringUtils.LINE_SEPARATOR
40-
+ " }, {"
41-
+ StringUtils.LINE_SEPARATOR
42-
+ " \"title\" : \"bar\""
43-
+ StringUtils.LINE_SEPARATOR
44-
+ " } ]"
45-
+ StringUtils.LINE_SEPARATOR
46-
+ "}";
36+
private static final String JSON_ENTRY_PRETTY;
37+
private static final String JSON_FEED_PRETTY;
4738

48-
public JacksonFactoryTest(String name) {
49-
super(name);
39+
static {
40+
JSON_ENTRY_PRETTY =
41+
"{" + StringUtils.LINE_SEPARATOR + " \"title\" : \"foo\"" + StringUtils.LINE_SEPARATOR + "}";
42+
JSON_FEED_PRETTY =
43+
"{"
44+
+ StringUtils.LINE_SEPARATOR
45+
+ " \"entries\" : [ {"
46+
+ StringUtils.LINE_SEPARATOR
47+
+ " \"title\" : \"foo\""
48+
+ StringUtils.LINE_SEPARATOR
49+
+ " }, {"
50+
+ StringUtils.LINE_SEPARATOR
51+
+ " \"title\" : \"bar\""
52+
+ StringUtils.LINE_SEPARATOR
53+
+ " } ]"
54+
+ StringUtils.LINE_SEPARATOR
55+
+ "}";
5056
}
5157

5258
@Override
5359
protected JsonFactory newFactory() {
5460
return new JacksonFactory();
5561
}
5662

63+
@Test
5764
public final void testToPrettyString_entry() throws Exception {
5865
Entry entry = new Entry();
5966
entry.title = "foo";
6067
assertEquals(JSON_ENTRY_PRETTY, newFactory().toPrettyString(entry));
6168
}
6269

70+
@Test
6371
public final void testToPrettyString_Feed() throws Exception {
6472
Feed feed = new Feed();
6573
Entry entryFoo = new Entry();
@@ -72,11 +80,13 @@ public final void testToPrettyString_Feed() throws Exception {
7280
assertEquals(JSON_FEED_PRETTY, newFactory().toPrettyString(feed));
7381
}
7482

83+
@Test
7584
public final void testParse_directValue() throws Exception {
7685
JsonParser parser = newFactory().createJsonParser("123");
7786
assertEquals(123, parser.parse(Integer.class, true));
7887
}
7988

89+
@Test
8090
public final void testGetByteValue() throws IOException {
8191
JsonParser parser = newFactory().createJsonParser("123");
8292

google-http-client-jackson2/src/test/java/com/google/api/client/json/jackson2/JacksonGeneratorTest.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,11 @@
2121

2222
public class JacksonGeneratorTest extends AbstractJsonGeneratorTest {
2323

24-
private static final JacksonFactory FACTORY = new JacksonFactory();
24+
private static final JacksonFactory FACTORY;
25+
26+
static {
27+
FACTORY = new JacksonFactory();
28+
}
2529

2630
@Override
2731
protected JsonGenerator newGenerator(Writer writer) throws IOException {

0 commit comments

Comments
 (0)