Migrate from the deprecated Charsets constants (in Guava) to the Stan… · grpc/grpc-java@0013609
@@ -31,7 +31,6 @@
3131import static org.mockito.Mockito.verify;
3232import static org.mockito.Mockito.verifyNoMoreInteractions;
333334-import com.google.common.base.Charsets;
3534import com.google.common.io.ByteStreams;
3635import com.google.common.primitives.Bytes;
3736import io.grpc.Codec;
@@ -46,6 +45,7 @@
4645import java.io.IOException;
4746import java.io.InputStream;
4847import java.io.OutputStream;
48+import java.nio.charset.StandardCharsets;
4949import java.util.Arrays;
5050import java.util.Collection;
5151import java.util.List;
@@ -347,7 +347,7 @@ public static class SizeEnforcingInputStreamTests {
347347348348@Test
349349public void sizeEnforcingInputStream_readByteBelowLimit() throws IOException {
350-ByteArrayInputStream in = new ByteArrayInputStream("foo".getBytes(Charsets.UTF_8));
350+ByteArrayInputStream in = new ByteArrayInputStream("foo".getBytes(StandardCharsets.UTF_8));
351351SizeEnforcingInputStream stream =
352352new MessageDeframer.SizeEnforcingInputStream(in, 4, statsTraceCtx);
353353@@ -360,7 +360,7 @@ public void sizeEnforcingInputStream_readByteBelowLimit() throws IOException {
360360361361@Test
362362public void sizeEnforcingInputStream_readByteAtLimit() throws IOException {
363-ByteArrayInputStream in = new ByteArrayInputStream("foo".getBytes(Charsets.UTF_8));
363+ByteArrayInputStream in = new ByteArrayInputStream("foo".getBytes(StandardCharsets.UTF_8));
364364SizeEnforcingInputStream stream =
365365new MessageDeframer.SizeEnforcingInputStream(in, 3, statsTraceCtx);
366366@@ -373,7 +373,7 @@ public void sizeEnforcingInputStream_readByteAtLimit() throws IOException {
373373374374@Test
375375public void sizeEnforcingInputStream_readByteAboveLimit() throws IOException {
376-ByteArrayInputStream in = new ByteArrayInputStream("foo".getBytes(Charsets.UTF_8));
376+ByteArrayInputStream in = new ByteArrayInputStream("foo".getBytes(StandardCharsets.UTF_8));
377377SizeEnforcingInputStream stream =
378378new MessageDeframer.SizeEnforcingInputStream(in, 2, statsTraceCtx);
379379@@ -390,7 +390,7 @@ public void sizeEnforcingInputStream_readByteAboveLimit() throws IOException {
390390391391@Test
392392public void sizeEnforcingInputStream_readBelowLimit() throws IOException {
393-ByteArrayInputStream in = new ByteArrayInputStream("foo".getBytes(Charsets.UTF_8));
393+ByteArrayInputStream in = new ByteArrayInputStream("foo".getBytes(StandardCharsets.UTF_8));
394394SizeEnforcingInputStream stream =
395395new MessageDeframer.SizeEnforcingInputStream(in, 4, statsTraceCtx);
396396byte[] buf = new byte[10];
@@ -404,7 +404,7 @@ public void sizeEnforcingInputStream_readBelowLimit() throws IOException {
404404405405@Test
406406public void sizeEnforcingInputStream_readAtLimit() throws IOException {
407-ByteArrayInputStream in = new ByteArrayInputStream("foo".getBytes(Charsets.UTF_8));
407+ByteArrayInputStream in = new ByteArrayInputStream("foo".getBytes(StandardCharsets.UTF_8));
408408SizeEnforcingInputStream stream =
409409new MessageDeframer.SizeEnforcingInputStream(in, 3, statsTraceCtx);
410410byte[] buf = new byte[10];
@@ -418,7 +418,7 @@ public void sizeEnforcingInputStream_readAtLimit() throws IOException {
418418419419@Test
420420public void sizeEnforcingInputStream_readAboveLimit() throws IOException {
421-ByteArrayInputStream in = new ByteArrayInputStream("foo".getBytes(Charsets.UTF_8));
421+ByteArrayInputStream in = new ByteArrayInputStream("foo".getBytes(StandardCharsets.UTF_8));
422422SizeEnforcingInputStream stream =
423423new MessageDeframer.SizeEnforcingInputStream(in, 2, statsTraceCtx);
424424byte[] buf = new byte[10];
@@ -435,7 +435,7 @@ public void sizeEnforcingInputStream_readAboveLimit() throws IOException {
435435436436@Test
437437public void sizeEnforcingInputStream_skipBelowLimit() throws IOException {
438-ByteArrayInputStream in = new ByteArrayInputStream("foo".getBytes(Charsets.UTF_8));
438+ByteArrayInputStream in = new ByteArrayInputStream("foo".getBytes(StandardCharsets.UTF_8));
439439SizeEnforcingInputStream stream =
440440new MessageDeframer.SizeEnforcingInputStream(in, 4, statsTraceCtx);
441441@@ -449,7 +449,7 @@ public void sizeEnforcingInputStream_skipBelowLimit() throws IOException {
449449450450@Test
451451public void sizeEnforcingInputStream_skipAtLimit() throws IOException {
452-ByteArrayInputStream in = new ByteArrayInputStream("foo".getBytes(Charsets.UTF_8));
452+ByteArrayInputStream in = new ByteArrayInputStream("foo".getBytes(StandardCharsets.UTF_8));
453453SizeEnforcingInputStream stream =
454454new MessageDeframer.SizeEnforcingInputStream(in, 3, statsTraceCtx);
455455@@ -462,7 +462,7 @@ public void sizeEnforcingInputStream_skipAtLimit() throws IOException {
462462463463@Test
464464public void sizeEnforcingInputStream_skipAboveLimit() throws IOException {
465-ByteArrayInputStream in = new ByteArrayInputStream("foo".getBytes(Charsets.UTF_8));
465+ByteArrayInputStream in = new ByteArrayInputStream("foo".getBytes(StandardCharsets.UTF_8));
466466SizeEnforcingInputStream stream =
467467new MessageDeframer.SizeEnforcingInputStream(in, 2, statsTraceCtx);
468468@@ -478,7 +478,7 @@ public void sizeEnforcingInputStream_skipAboveLimit() throws IOException {
478478479479@Test
480480public void sizeEnforcingInputStream_markReset() throws IOException {
481-ByteArrayInputStream in = new ByteArrayInputStream("foo".getBytes(Charsets.UTF_8));
481+ByteArrayInputStream in = new ByteArrayInputStream("foo".getBytes(StandardCharsets.UTF_8));
482482SizeEnforcingInputStream stream =
483483new MessageDeframer.SizeEnforcingInputStream(in, 3, statsTraceCtx);
484484// stream currently looks like: |foo