### Question:
ChunkManager { public void addMetric(final String metricString) { try { String[] metricParts = metricString.split(" "); if (metricParts.length > 1 && metricParts[0].equals("put")) { String metricName = metricParts[1].trim(); List<String> rawTags = Arrays.asList(metricParts).subList(4, metricParts.length); Metric metric = new Metric(metricName, rawTags); long ts = Long.parseLong(metricParts[2].trim()); double value = Double.parseDouble(metricParts[3].trim()); Chunk chunk = getChunk(ts); if (!chunk.isReadOnly()) { chunk.addPoint(metric, ts, value); } else { throw new ReadOnlyChunkInsertionException("Inserting metric into a read only store:" + metricString); } } else { throw new IllegalArgumentException("Metric doesn't start with a put: " + metricString); } } catch (ReadOnlyChunkInsertionException re) { throw re; } catch (Exception e) { LOG.error("metric failed with exception: ", e); throw new IllegalArgumentException("Invalid metric string " + metricString, e); } } ChunkManager(String chunkDataPrefix, int expectedTagStoreSize);  ChunkManager(String chunkDataPrefix, int expectedTagStoreSize, String dataDirectory); Chunk getChunk(long timestamp); void addMetric(final String metricString); List<TimeSeries> queryAroundChunkBoundaries(Query query, long startTsSecs,
                                                     long endTsSecs,
                                                     QueryAggregation queryAggregation); List<TimeSeries> query(Query query, long startTsSecs, long endTsSecs,
                                QueryAggregation queryAggregation); void toReadOnlyChunks(List<Map.Entry<Long, Chunk>> expiredChunks); void removeStaleChunks(List<Map.Entry<Long, Chunk>> staleChunks); static Duration DEFAULT_CHUNK_DURATION; }### Answer:
@Test(expected = IllegalArgumentException.class) public void testInvalidMetricName() { chunkManager.addMetric("random"); }
@Test public void testMetricMissingTags() { String metric = "put a.b.c.d-e 1465530393 0"; chunkManager.addMetric(metric); }
@Test(expected = IllegalArgumentException.class) public void testMetricInvalidTs() { String metric = "put a.b.c.d-e 1465530393a 0"; chunkManager.addMetric(metric); }
@Test(expected = IllegalArgumentException.class) public void testMetricInvalidValue() { String metric = "put a.b.c.d-e 1465530393 a0"; chunkManager.addMetric(metric); }
@Test(expected = IllegalArgumentException.class) public void testMetricInvalidTag() { String metric = "put a.b.c.d-e 1465530393 0 a"; chunkManager.addMetric(metric); }
@Test(expected = IllegalArgumentException.class) public void testMissingMetricName() { String metric = "put 1465530393 0"; chunkManager.addMetric(metric); }
@Test(expected = IllegalArgumentException.class) public void testMissingValue() { String metric = "put a.b 1465530393 c=d"; chunkManager.addMetric(metric); }
@Test(expected = IllegalArgumentException.class) public void testMissingTs() { String metric = "put a.b 5.1 c=d"; chunkManager.addMetric(metric); }