@Test public void testCombineValuesFnCoders() throws Exception { CoderRegistry registry = new CoderRegistry(); registry.registerStandardCoders(); MeanInts meanInts = new MeanInts(); MeanInts.CountSum countSum = meanInts.new CountSum(6, 27); Coder<MeanInts.CountSum> coder = meanInts.getAccumulatorCoder( registry, registry.getDefaultCoder(TypeDescriptor.of(Integer.class))); assertEquals( countSum, CoderUtils.decodeFromByteArray(coder, CoderUtils.encodeToByteArray(coder, countSum))); }
private void checkRegistry(Class<? extends Mutation> mutationClass) throws CannotProvideCoderException { Coder<? extends Mutation> coder = registry.getCoder(TypeDescriptor.of(mutationClass)); assertNotNull(coder); assertEquals(HBaseMutationCoder.class, coder.getClass()); }
@Test public void testIncrementThrowsCannotProvideCoderException() throws Exception { expectedException.expect(CannotProvideCoderException.class); registry.getCoder(TypeDescriptor.of(Increment.class)); }