Exemplo n.º 1
0
 @Test
 public void shouldFindMethodsWithNameMatchingRegularExpression() {
   Method[] stringMethods = stringReflection.findMethods("indexO.", true);
   assertThat(stringMethods.length, is(4));
   for (Method method : stringMethods) {
     assertThat(method.getName(), is("indexOf"));
   }
   stringMethods = stringReflection.findMethods(".+gth", true);
   assertThat(stringMethods.length, is(1));
   for (Method method : stringMethods) {
     assertThat(method.getName(), is("length"));
   }
 }
Exemplo n.º 2
0
 @Test
 public void shouldNotFindMethodsWhenThereAreNoMethodsWithThatName() {
   assertThat(stringReflection.findMethods("size", true).length, is(0));
   assertThat(stringListReflection.findMethods("argleBargle", true).length, is(0));
 }