"null.all.Context.Context=all.Hostname=host.foo1 1.25 10\n"));
}
@Test
public void testPutMetrics2() {
GraphiteSink sink = new GraphiteSink();
List<MetricsTag> tags = new ArrayList<MetricsTag>();
tags.add(new MetricsTag(MsInfo.Context, "all"));
tags.add(new MetricsTag(MsInfo.Hostname, null));
Set<AbstractMetric> metrics = new HashSet<AbstractMetric>();
metrics.add(makeMetric("foo1", 1));
metrics.add(makeMetric("foo2", 2));
MetricsRecord record = new MetricsRecordImpl(MsInfo.Context, (long) 10000, tags, metrics);
OutputStreamWriter mockWriter = mock(OutputStreamWriter.class);
ArgumentCaptor<String> argument = ArgumentCaptor.forClass(String.class);
Whitebox.setInternalState(sink, "writer", mockWriter);
sink.putMetrics(record);
try {
verify(mockWriter).write(argument.capture());
} catch (IOException e) {
e.printStackTrace();