Skip to content

remove deprecated code, fix warnings, and use JUnit 4 #763

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 5, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,9 @@

import com.google.api.client.http.HttpMethods;
import com.google.api.client.http.HttpTransport;
import com.google.api.client.util.Preconditions;
import com.google.api.client.util.SecurityUtils;
import com.google.api.client.util.SslUtils;
import java.io.IOException;
import java.io.InputStream;
import java.net.ProxySelector;
import java.security.GeneralSecurityException;
import java.security.KeyStore;
import java.security.cert.CertificateFactory;
import java.util.concurrent.TimeUnit;
import javax.net.ssl.SSLContext;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpDelete;
import org.apache.http.client.methods.HttpGet;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
*/

/**
* HTTP Transport library for Google API's based on Apache HTTP Client version 4.5+
* HTTP Transport library for Google API's based on Apache HTTP Client version 4.5+.
*
* @since 1.30
* @author Yaniv Inbar
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ public void testSerialize_simpleMap() throws Exception {
StringWriter writer = new StringWriter();
JsonGenerator generator = newGenerator(writer);

Map m = new HashMap<String, String>();
m.put("a", "b");
Map<String, String> map = new HashMap<String, String>();
map.put("a", "b");

generator.serialize(m);
generator.serialize(map);
generator.close();
assertEquals("{\"a\":\"b\"}", writer.toString());
}
Expand All @@ -50,10 +50,10 @@ public void testSerialize_iterableMap() throws Exception {
StringWriter writer = new StringWriter();
JsonGenerator generator = newGenerator(writer);

Map m = new IterableMap();
m.put("a", "b");
Map<String, String> map = new IterableMap();
map.put("a", "b");

generator.serialize(m);
generator.serialize(map);
generator.close();
assertEquals("{\"a\":\"b\"}", writer.toString());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ public abstract class AbstractJsonParserTest extends TestCase {

protected abstract JsonFactory newJsonFactory();

private static String TEST_JSON =
private static final String TEST_JSON =
"{\"strValue\": \"bar\", \"intValue\": 123, \"boolValue\": false}";
private static String TEST_JSON_BIG_DECIMAL = "{\"bigDecimalValue\": 1559341956102}";
private static final String TEST_JSON_BIG_DECIMAL = "{\"bigDecimalValue\": 1559341956102}";

public void testParse_basic() throws IOException {
JsonObjectParser parser = new JsonObjectParser(newJsonFactory());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ private static Proxy defaultProxy() {

private static final String SHOULD_USE_PROXY_FLAG = "com.google.api.client.should_use_proxy";

/** Factory to produce connections from {@link URL}s */
private final ConnectionFactory connectionFactory;

/** SSL socket factory or {@code null} for the default. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ public static FieldInfo of(Field field) {
/** Field. */
private final Field field;

/** Setters Method for field */
private final Method[] setters;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Lists;

import junit.framework.TestCase;

import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.util.Arrays;
Expand All @@ -41,8 +44,8 @@
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.logging.Level;
import junit.framework.Assert;
import junit.framework.TestCase;

import org.junit.Assert;

/**
* Tests {@link HttpRequest}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,14 @@
package com.google.api.client.util;

import com.google.api.client.util.GenericData.Flags;

import junit.framework.TestCase;

import java.util.ArrayList;
import java.util.EnumSet;
import java.util.List;
import junit.framework.Assert;
import junit.framework.TestCase;

import org.junit.Assert;

/**
* Tests {@link GenericData}.
Expand Down Expand Up @@ -191,7 +194,7 @@ public void testPutShouldUseSetter() {
MyData data = new MyData();
data.put("fieldB", "value1");
assertEquals("value1", data.fieldB.get(0));
List<String> list = new ArrayList();
List<String> list = new ArrayList<>();
list.add("value2");
data.put("fieldB", list);
assertEquals(list, data.fieldB);
Expand Down