### Question:
GraphiteHandler extends SimpleChannelInboundHandler<String> { static Sample parseSample(String line) { List<String> parts = s_lineTokenizer.splitToList(line); String[] path = s_pathTokenizer.splitToList(parts.get(0)).toArray(new String[] {}); Resource resource = parseResource(path.length > 1 ? Arrays.copyOf(path, path.length - 1) : path); String name = path.length > 1 ? path[path.length - 1] : "value"; Double value = Double.parseDouble(parts.get(1)); Long stamp = Long.parseLong(parts.get(2)); return sample(fromEpochSeconds(stamp), resource, name, value); } GraphiteHandler(SampleRepository repository, GraphiteInitializer parent); @Override void exceptionCaught(ChannelHandlerContext ctx, Throwable cause);  }### Answer:
@Test public void testParseSample() { Sample sample = parseSample("foo.bar.baz 5 10000"); assertThat(sample.getResource().getId(), is("foo:bar")); assertThat(sample.getName(), is("baz")); assertThat(sample.getValue().intValue(), equalTo(5)); assertThat(sample.getTimestamp().asSeconds(), equalTo(10000L)); sample = parseSample("foo 5 10000"); assertThat(sample.getResource().getId(), is("foo")); assertThat(sample.getName(), is("value")); }