Code example for Method

Methods: getModifiers

0
  @Test 
  public void soMockitoDoesntExplodeDueToTooManyMethods_shouldGenerateDirectAccessMethodWhichIsPrivate() throws Exception { 
    Class<?> exampleClass = loadClass(AnExampleClass.class);
    String methodName = RobolectricInternals.directMethodName("normalMethod");
    Method directMethod = exampleClass.getDeclaredMethod(methodName, String.class, int.class);
    assertTrue(Modifier.isPrivate(directMethod.getModifiers()));
    assertFalse(Modifier.isFinal(directMethod.getModifiers()));
  } 
 
  @Test 
  public void soMockitoDoesntExplodeDueToTooManyMethods_shouldGenerateClassSpecificDirectAccessMethodWhichIsPrivateAndFinal() throws Exception { 
    Class<?> exampleClass = loadClass(AnExampleClass.class);
    String methodName = RobolectricInternals.directMethodName(AnExampleClass.class.getName(), "normalMethod");
    Method directMethod = exampleClass.getDeclaredMethod(methodName, String.class, int.class);
    assertTrue(Modifier.isPrivate(directMethod.getModifiers()));
    assertTrue(Modifier.isFinal(directMethod.getModifiers()));
  } 
 
  @Test 
  public void callingStaticMethodShouldInvokeClassHandler() throws Exception { 
    Class<?> exampleClass = loadClass(AClassWithStaticMethod.class);