@Test public void idempotent() { MethodDescriptor<String, String> descriptor = MethodDescriptor.<String, String>create( MethodType.SERVER_STREAMING, "/package.service/method", new StringMarshaller(), new StringMarshaller()); assertFalse(descriptor.isIdempotent()); // Create a new desriptor by setting idempotent to true MethodDescriptor<String, String> newDescriptor = descriptor.withIdempotent(true); assertTrue(newDescriptor.isIdempotent()); // All other fields should staty the same assertEquals(MethodType.SERVER_STREAMING, newDescriptor.getType()); assertEquals("/package.service/method", newDescriptor.getFullMethodName()); }
@Test public void createMethodDescriptor() { MethodDescriptor<String, String> descriptor = MethodDescriptor.<String, String>create( MethodType.CLIENT_STREAMING, "/package.service/method", new StringMarshaller(), new StringMarshaller()); assertEquals(MethodType.CLIENT_STREAMING, descriptor.getType()); assertEquals("/package.service/method", descriptor.getFullMethodName()); assertFalse(descriptor.isIdempotent()); }