83262bc5185ee9bdf768f7359dde3ce7bf4ac6f5
[yangtools.git] / mockito-configuration / src / main / java / org / mockito / configuration / ThrowsUnstubbedMethodException.java
1 /*
2  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.mockito.configuration;
9
10 import java.io.Serializable;
11
12 import org.mockito.invocation.InvocationOnMock;
13 import org.mockito.stubbing.Answer;
14
15 /**
16  * Answer that throws {@link UnstubbedMethodException}.
17  */
18 public class ThrowsUnstubbedMethodException implements Answer<Object>, Serializable {
19         private static final long serialVersionUID = 1L;
20
21     public ThrowsUnstubbedMethodException() {
22     }
23
24     @Override
25         public Object answer(InvocationOnMock invocation) throws Throwable {
26         Throwable t = new UnstubbedMethodException(invocation.toString() + " was not stubbed");
27         throw t;
28     }
29 }