Skip to content

Commit

Permalink
Cleanup: remove deprecated code, fix warnings, and use JUnit 4 (#763)
Browse files Browse the repository at this point in the history
* remove deprecated code, fix warnings, an duse JUnit 4

* generics
  • Loading branch information
elharo authored and chingor13 committed Aug 5, 2019
1 parent 9916535 commit 74dd65f
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 24 deletions.
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
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
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
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
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
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
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
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

0 comments on commit 74dd65f

Please sign in to comment.