Migrate from the deprecated Charsets constants (in Guava) to the Stan… · grpc/grpc-java@0013609

@@ -31,7 +31,6 @@

3131

import static org.mockito.Mockito.verify;

3232

import static org.mockito.Mockito.verifyNoMoreInteractions;

333334-

import com.google.common.base.Charsets;

3534

import com.google.common.io.ByteStreams;

3635

import com.google.common.primitives.Bytes;

3736

import io.grpc.Codec;

@@ -46,6 +45,7 @@

4645

import java.io.IOException;

4746

import java.io.InputStream;

4847

import java.io.OutputStream;

48+

import java.nio.charset.StandardCharsets;

4949

import java.util.Arrays;

5050

import java.util.Collection;

5151

import java.util.List;

@@ -347,7 +347,7 @@ public static class SizeEnforcingInputStreamTests {

347347348348

@Test

349349

public 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));

351351

SizeEnforcingInputStream stream =

352352

new MessageDeframer.SizeEnforcingInputStream(in, 4, statsTraceCtx);

353353

@@ -360,7 +360,7 @@ public void sizeEnforcingInputStream_readByteBelowLimit() throws IOException {

360360361361

@Test

362362

public 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));

364364

SizeEnforcingInputStream stream =

365365

new MessageDeframer.SizeEnforcingInputStream(in, 3, statsTraceCtx);

366366

@@ -373,7 +373,7 @@ public void sizeEnforcingInputStream_readByteAtLimit() throws IOException {

373373374374

@Test

375375

public 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));

377377

SizeEnforcingInputStream stream =

378378

new MessageDeframer.SizeEnforcingInputStream(in, 2, statsTraceCtx);

379379

@@ -390,7 +390,7 @@ public void sizeEnforcingInputStream_readByteAboveLimit() throws IOException {

390390391391

@Test

392392

public 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));

394394

SizeEnforcingInputStream stream =

395395

new MessageDeframer.SizeEnforcingInputStream(in, 4, statsTraceCtx);

396396

byte[] buf = new byte[10];

@@ -404,7 +404,7 @@ public void sizeEnforcingInputStream_readBelowLimit() throws IOException {

404404405405

@Test

406406

public 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));

408408

SizeEnforcingInputStream stream =

409409

new MessageDeframer.SizeEnforcingInputStream(in, 3, statsTraceCtx);

410410

byte[] buf = new byte[10];

@@ -418,7 +418,7 @@ public void sizeEnforcingInputStream_readAtLimit() throws IOException {

418418419419

@Test

420420

public 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));

422422

SizeEnforcingInputStream stream =

423423

new MessageDeframer.SizeEnforcingInputStream(in, 2, statsTraceCtx);

424424

byte[] buf = new byte[10];

@@ -435,7 +435,7 @@ public void sizeEnforcingInputStream_readAboveLimit() throws IOException {

435435436436

@Test

437437

public 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));

439439

SizeEnforcingInputStream stream =

440440

new MessageDeframer.SizeEnforcingInputStream(in, 4, statsTraceCtx);

441441

@@ -449,7 +449,7 @@ public void sizeEnforcingInputStream_skipBelowLimit() throws IOException {

449449450450

@Test

451451

public 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));

453453

SizeEnforcingInputStream stream =

454454

new MessageDeframer.SizeEnforcingInputStream(in, 3, statsTraceCtx);

455455

@@ -462,7 +462,7 @@ public void sizeEnforcingInputStream_skipAtLimit() throws IOException {

462462463463

@Test

464464

public 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));

466466

SizeEnforcingInputStream stream =

467467

new MessageDeframer.SizeEnforcingInputStream(in, 2, statsTraceCtx);

468468

@@ -478,7 +478,7 @@ public void sizeEnforcingInputStream_skipAboveLimit() throws IOException {

478478479479

@Test

480480

public 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));

482482

SizeEnforcingInputStream stream =

483483

new MessageDeframer.SizeEnforcingInputStream(in, 3, statsTraceCtx);

484484

// stream currently looks like: |foo