blob: 38843191a0c4c380790069e25ad9cb0ecb8d7dcb [file] [log] [blame]
/*
* Copyright (c) 2007 Mockito contributors
* This program is made available under the terms of the MIT License.
*/
package org.mockitousage.bugs;
import org.junit.Test;
import org.mockito.Mock;
import org.mockitousage.IMethods;
import org.mockitoutil.TestBase;
import static junit.framework.TestCase.fail;
import static org.mockito.Mockito.when;
public class NPEWhenMockingThrowablesTest extends TestBase {
@Mock IMethods mock;
@Mock DummyException mock2;
class DummyException extends RuntimeException {
private static final long serialVersionUID = 1L;
}
//issue 70
@Test
public void shouldNotThrowNPE() {
when(mock.simpleMethod()).thenThrow(mock2);
try {
mock.simpleMethod();
fail();
} catch(DummyException e) {}
}
}