Exemplo n.º 1
0
 public void testInStr() {
   assertEquals(1, Vba.inStr("the quick brown fox jumps over the lazy dog", "the"));
   assertEquals(32, Vba.inStr(16, "the quick brown fox jumps over the lazy dog", "the"));
   assertEquals(0, Vba.inStr(16, "the quick brown fox jumps over the lazy dog", "cat"));
   assertEquals(0, Vba.inStr(1, "the quick brown fox jumps over the lazy dog", "cat"));
   assertEquals(0, Vba.inStr(1, "", "cat"));
   assertEquals(0, Vba.inStr(100, "short string", "str"));
   try {
     Vba.inStr(0, "the quick brown fox jumps over the lazy dog", "the");
     fail();
   } catch (InvalidArgumentException e) {
     assertTrue(e.getMessage().indexOf("-1 or a location") >= 0);
   }
 }