Example #1
0
 @Test
 public void test_metricName_empty_invalid() throws DatastoreException, ValidationException {
   try {
     command.execute(
         new FakeChannel(),
         new String[] {"telnet", "", "12345678999", "789", "foo=bar", "fum=barfum"});
     fail("ValidationException expected");
   } catch (DatastoreException e) {
     fail("ValidationException expected");
   } catch (ValidationException e) {
     assertThat(e.getMessage(), equalTo("metricName may not be empty."));
   }
 }
Example #2
0
 @Test
 public void test_tag_invalid() throws DatastoreException, ValidationException {
   try {
     command.execute(
         new FakeChannel(),
         new String[] {"telnet", "metricName", "12345678999", "789", "foo=bar", "fum-barfum"});
     fail("ValidationException expected");
   } catch (DatastoreException e) {
     fail("ValidationException expected");
   } catch (ValidationException e) {
     assertThat(e.getMessage(), equalTo("tag[1] must be in the format 'name=value'."));
   }
 }
Example #3
0
 @Test
 public void test_metricName_characters_invalid() throws DatastoreException, ValidationException {
   try {
     command.execute(
         new FakeChannel(),
         new String[] {"telnet", "foo:bar", "12345678999", "789", "foo=bar", "fum=barfum"});
     fail("ValidationException expected");
   } catch (DatastoreException e) {
     fail("ValidationException expected");
   } catch (ValidationException e) {
     assertThat(
         e.getMessage(),
         equalTo(
             "metricName may only contain alphanumeric characters plus periods '.', slash '/', dash '-', and underscore '_'."));
   }
 }