How can I mock just for a non-null value?
<p>Let's say I'm testing following method.</p>

<pre class="lang-java prettyprint-override"><code>/**
 * Does something. This method throws a {@code NullPointerException}
 * either given string or specified charset is {@code null}.
 * @param s the string
 * @param c the charset
 */
void doSomething(String s, Charset c) {
}
</code></pre>

<p>How, when I test, can I make mock for a non-null purpose?</p>

<pre class="lang-java prettyprint-override"><code>assertThrows(NullPointerException.class,
             new MyObject().doSomething(null, UTF_8));
assertThrows(NullPointerException.class,
             new MyObject().doSomething("", null));
</code></pre>

<p>Is there any libraries/methods for mocking a general non-null value?</p>

<p>I tried <code>Mockito.mock</code> and it seems throw an Exception for some invalid types for it can actually mock.</p>

<p><strong>Update</strong></p>

<p>By user2004685's answer, now, I'm curious if I can use <code>anyString</code> or <code>any(Class)</code> like this.</p>

<pre class="lang-java prettyprint-override"><code>assertThrows(NullPointerException.class,
             new MyObject().doSomething(null, any(Charset.class)));
assertThrows(NullPointerException.class,
             new MyObject().doSomething(anyString(), null));
</code></pre>