title: NPE on unit test using mockito
body: <p>I tried to unit test some util class, below :</p>
  
  <pre><code>public final class WalletInputValidationUtils {
  private WalletInputValidationUtils() {
  }
  
  public static boolean isEmailValid(CharSequence email) {
      return Patterns.EMAIL_ADDRESS.matcher(email).matches();
  }
  }
  </code></pre>
  
  <p>and this is the test class</p>
  
  <pre><code>@RunWith(PowerMockRunner.class)
  public class WalletInputValidationUtilsTest {
  private static final CharSequence DUMMY_EMAIL = "email@gmail.com";
  
  @Test
  public void isEmailValidTest1() {
      Assert.assertTrue(isEmailValid(DUMMY_EMAIL));
  }
  }
  </code></pre>
  
  <p>I got null pointer exception in this line</p>
  
  <pre><code>return Patterns.EMAIL_ADDRESS.matcher(email).matches();
  </code></pre>
  
  <p>this is the stack trace</p>
  
  <pre><code>java.lang.NullPointerException
  at kudo.mobile.app.wallet.backwardcompatibility.WalletInputValidationUtils.isEmailValid(WalletInputValidationUtils.java:14)
  at kudo.mobile.app.wallet.backwardcompatibility.WalletInputValidationUtilsTest.isEmailValidTest(WalletInputValidationUtilsTest.java:31)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:498)
  at org.junit.internal.runners.TestMethod.invoke(TestMethod.java:68)
  at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl$PowerMockJUnit44MethodRunner.runTestMethod(PowerMockJUnit44RunnerDelegateImpl.java:316)
  at org.junit.internal.runners.MethodRoadie$2.run(MethodRoadie.java:89)
  at org.junit.internal.runners.MethodRoadie.runBeforesThenTestThenAfters(MethodRoadie.java:97)
  at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl$PowerMockJUnit44MethodRunner.executeTest(PowerMockJUnit44RunnerDelegateImpl.java:300)
  at org.powermock.modules.junit4.internal.impl.PowerMockJUnit47RunnerDelegateImpl$PowerMockJUnit47MethodRunner.executeTestInSuper(PowerMockJUnit47RunnerDelegateImpl.java:131)
  at org.powermock.modules.junit4.internal.impl.PowerMockJUnit47RunnerDelegateImpl$PowerMockJUnit47MethodRunne
  </code></pre>
  
  <p>Can anyone help me to fix this ? thanks</p>