Spotify100ProtoSerializer implements Serializer { @Override public byte[] serialize(final Metric metric) throws Exception { throw new UnsupportedOperationException("Not supported"); }  @Override byte[] serialize(final Metric metric); @Override byte[] serialize(Collection<Metric> metrics, WriteCache writeCache); @Override byte[] serializeMetrics(final Collection<com.spotify.ffwd.model.v2.Metric> metrics,
                                 WriteCache writeCache);  }
@Test(expected = UnsupportedOperationException.class) public void testSerializeMetricV2() throws Exception { metricV2 = create("",distributionDoubleValue,time,tags,resource); serializer.serialize(metric1); }
@Test(expected = NullPointerException.class) public void testNullKeyExceptionV2() throws Exception { metricV2 = create(null,distributionDoubleValue,time,tags,resource); serializer.serialize(ImmutableList.of(metric1), writeCache); }
@Test(expected = NullPointerException.class) public void testNullValueExceptionV2() throws Exception { metricV2 = create(key,null,time,tags,resource); serializer.serialize(ImmutableList.of(metric1), writeCache); }
@Test(expected = NullPointerException.class) public void testNullKeyException() throws Exception { metric1 = create(null,value,date, riemannTags,tags,resource,proc); serializer.serialize(ImmutableList.of(metric1), writeCache); }
@Test public void testSerializedMetricBatching() throws Exception { Metric metric1 = create(key,0.001,date,riemannTags,tags,resource,proc); Metric metric2 = create(key,0.002,date,riemannTags,tags,resource,proc); Metric metric3 = create(key,0.0003,date,riemannTags,tags,resource,proc); List<Metric> batchIn = ImmutableList.of(metric1,metric2,metric3); final byte [] bytes = serializer.serialize( batchIn, writeCache ); Spotify100.Batch spotify100BatchOut = deserialize(bytes); assertThat( batchIn.size(), is(spotify100BatchOut.getMetricList().size())); }