1 /*
2  * Copyright (c) 2007 Mockito contributors
3  * This program is made available under the terms of the MIT License.
4  */
5 package org.mockito.internal.stubbing;
6 
7 import org.mockito.quality.Strictness;
8 import org.mockito.stubbing.Answer;
9 
10 import java.io.Serializable;
11 import java.util.ArrayList;
12 import java.util.List;
13 
14 /**
15  * Holds answers declared using 'doAnswer' stubbing style.
16  */
17 class DoAnswerStyleStubbing implements Serializable {
18 
19     private final List<Answer<?>> answers = new ArrayList<Answer<?>>();
20     private Strictness stubbingStrictness;
21 
setAnswers(List<Answer<?>> answers, Strictness stubbingStrictness)22     void setAnswers(List<Answer<?>> answers, Strictness stubbingStrictness) {
23         this.stubbingStrictness = stubbingStrictness;
24         this.answers.addAll(answers);
25     }
26 
isSet()27     boolean isSet() {
28         return answers.isEmpty();
29     }
30 
clear()31     void clear() {
32         answers.clear();
33         stubbingStrictness = null;
34     }
35 
getAnswers()36     List<Answer<?>> getAnswers() {
37         return answers;
38     }
39 
getStubbingStrictness()40     Strictness getStubbingStrictness() {
41         return stubbingStrictness;
42     }
43 }
44