Beispiel #1
0
 @Test
 public void testRelativeLabel() throws Exception {
   assertEquals(Label.parseAbsolute("//quux:wiz"), Type.LABEL.convert(":wiz", null, currentRule));
   assertEquals(Label.parseAbsolute("//quux:wiz"), Type.LABEL.convert("wiz", null, currentRule));
   try {
     Type.LABEL.convert("wiz", null);
     fail();
   } catch (NullPointerException e) {
     /* ok */
   }
 }
Beispiel #2
0
 @Test
 public void testNonLabel() throws Exception {
   try {
     Type.LABEL.convert(3, null);
     fail();
   } catch (Type.ConversionException e) {
     assertThat(e).hasMessage("expected value of type 'string', but got 3 (int)");
   }
 }
Beispiel #3
0
 @Test
 public void testInvalidLabel() throws Exception {
   try {
     Type.LABEL.convert("not a label", null, currentRule);
     fail();
   } catch (Type.ConversionException e) {
     MoreAsserts.assertContainsWordsWithQuotes(e.getMessage(), "not a label");
   }
 }
Beispiel #4
0
 @Test
 public void testLabel() throws Exception {
   Label label = Label.parseAbsolute("//foo:bar");
   assertEquals(label, Type.LABEL.convert("//foo:bar", null, currentRule));
   assertThat(Type.LABEL.flatten(label)).containsExactly(label);
 }