• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2016 Mockito contributors
3  * This program is made available under the terms of the MIT License.
4  */
5 package org.mockito.stubbing;
6 
7 /**
8  * Generic interface to be used for configuring mock's answer for a six argument invocation that returns nothing.
9  *
10  * Answer specifies an action that is executed when you interact with the mock.
11  * <p>
12  * Example of stubbing a mock with this custom answer:
13  *
14  * <pre class="code"><code class="java">
15  * import static org.mockito.AdditionalAnswers.answerVoid;
16  *
17  * doAnswer(answerVoid(
18  *     new VoidAnswer5&lt;String, Integer, String, Character, Object, String&gt;() {
19  *         public void answer(String msg, Integer count, String another, Character c, Object o, String subject) throws Exception {
20  *             throw new Exception(String.format(msg, another, c, o, count, subject));
21  *         }
22  * })).when(mock).someMethod(anyString(), anyInt(), anyString(), anyChar(), any(), anyString());
23  *
24  * // The following will raise an exception with the message "ka-boom &lt;3 mockito"
25  * mock.someMethod("%s-boom %c%d %s", 3, "ka", '&lt;', new Object(), "mockito");
26  * </code></pre>
27  *
28  * @param <A0> type of the first argument
29  * @param <A1> type of the second argument
30  * @param <A2> type of the third argument
31  * @param <A3> type of the fourth argument
32  * @param <A4> type of the fifth argument
33  * @param <A5> type of the sixth argument
34  * @see Answer
35  */
36 public interface VoidAnswer6<A0, A1, A2, A3, A4, A5> {
37     /**
38      * @param argument0 the first argument.
39      * @param argument1 the second argument.
40      * @param argument2 the third argument.
41      * @param argument3 the fourth argument.
42      * @param argument4 the fifth argument.
43      * @param argument5 the sixth argument.
44      *
45      * @throws Throwable the throwable to be thrown
46      */
answer(A0 argument0, A1 argument1, A2 argument2, A3 argument3, A4 argument4, A5 argument5)47     void answer(A0 argument0, A1 argument1, A2 argument2, A3 argument3, A4 argument4, A5 argument5)
48             throws Throwable;
49 }
50