mirror of https://github.com/grpc/grpc-java.git
core: remove unused, non-public INTEGER_MARSHALLER (#3530)
This commit is contained in:
parent
0d5943614e
commit
f5026cd334
|
|
@ -104,21 +104,6 @@ public final class Metadata {
|
|||
}
|
||||
};
|
||||
|
||||
/** Simple metadata marshaller that encodes an integer as a signed decimal string. */
|
||||
static final AsciiMarshaller<Integer> INTEGER_MARSHALLER =
|
||||
new AsciiMarshaller<Integer>() {
|
||||
|
||||
@Override
|
||||
public String toAsciiString(Integer value) {
|
||||
return value.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer parseAsciiString(String serialized) {
|
||||
return Integer.parseInt(serialized);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Constructor called by the transport layer when it receives binary metadata. Metadata will
|
||||
* mutate the passed in array.
|
||||
|
|
|
|||
|
|
@ -213,20 +213,6 @@ public class MetadataTest {
|
|||
h1.merge(h2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void integerMarshallerIsDecimal() {
|
||||
assertEquals("12345678", Metadata.INTEGER_MARSHALLER.toAsciiString(12345678));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void roundTripIntegerMarshaller() {
|
||||
roundTripInteger(0);
|
||||
roundTripInteger(1);
|
||||
roundTripInteger(-1);
|
||||
roundTripInteger(0x12345678);
|
||||
roundTripInteger(0x87654321);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shortBinaryKeyName() {
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
|
|
@ -242,11 +228,6 @@ public class MetadataTest {
|
|||
Metadata.Key.of("nonbinary", FISH_MARSHALLER);
|
||||
}
|
||||
|
||||
private void roundTripInteger(Integer i) {
|
||||
assertEquals(i, Metadata.INTEGER_MARSHALLER.parseAsciiString(
|
||||
Metadata.INTEGER_MARSHALLER.toAsciiString(i)));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void verifyToString() {
|
||||
Metadata h = new Metadata();
|
||||
|
|
@ -329,9 +310,9 @@ public class MetadataTest {
|
|||
|
||||
@Test
|
||||
public void keyEqualsHashNameWorks() {
|
||||
Key<Integer> k1 = Key.of("case", Metadata.INTEGER_MARSHALLER);
|
||||
Key<?> k1 = Key.of("case", Metadata.ASCII_STRING_MARSHALLER);
|
||||
|
||||
Key<Integer> k2 = Key.of("CASE", Metadata.INTEGER_MARSHALLER);
|
||||
Key<?> k2 = Key.of("CASE", Metadata.ASCII_STRING_MARSHALLER);
|
||||
assertEquals(k1, k1);
|
||||
assertNotEquals(k1, null);
|
||||
assertNotEquals(k1, new Object(){});
|
||||
|
|
@ -346,7 +327,7 @@ public class MetadataTest {
|
|||
@Test
|
||||
public void invalidKeyName() {
|
||||
try {
|
||||
Key.of("io.grpc/key1", Metadata.INTEGER_MARSHALLER);
|
||||
Key.of("io.grpc/key1", Metadata.ASCII_STRING_MARSHALLER);
|
||||
fail("Should have thrown");
|
||||
} catch (IllegalArgumentException e) {
|
||||
assertEquals("Invalid character '/' in key name 'io.grpc/key1'", e.getMessage());
|
||||
|
|
|
|||
Loading…
Reference in New Issue