1 /* 2 * Copyright (c) 2007 Mockito contributors 3 * This program is made available under the terms of the MIT License. 4 */ 5 6 package org.mockito.internal.verification; 7 8 import org.junit.Before; 9 import org.junit.Test; 10 import org.mockito.internal.invocation.InvocationBuilder; 11 import org.mockito.invocation.Invocation; 12 import org.mockitoutil.TestBase; 13 14 import static junit.framework.TestCase.assertFalse; 15 import static junit.framework.TestCase.assertTrue; 16 17 public class DefaultRegisteredInvocationsTest extends TestBase { 18 19 private DefaultRegisteredInvocations invocations; 20 21 @Before setup()22 public void setup() { 23 invocations = new DefaultRegisteredInvocations(); 24 } 25 26 @Test should_not_return_to_string_method()27 public void should_not_return_to_string_method() throws Exception { 28 Invocation toString = new InvocationBuilder().method("toString").toInvocation(); 29 Invocation simpleMethod = new InvocationBuilder().simpleMethod().toInvocation(); 30 31 invocations.add(toString); 32 invocations.add(simpleMethod); 33 34 assertTrue(invocations.getAll().contains(simpleMethod)); 35 assertFalse(invocations.getAll().contains(toString)); 36 } 37 } 38