1 /* 2 * Copyright (c) 2007 Mockito contributors 3 * This program is made available under the terms of the MIT License. 4 */ 5 package org.mockitousage.bugs; 6 7 import org.junit.Test; 8 import org.mockitoutil.TestBase; 9 10 import static org.mockito.Mockito.*; 11 12 // see issue 112 13 public class AtLeastMarksAllInvocationsVerified extends TestBase { 14 15 public static class SomeMethods { allowedMethod()16 public void allowedMethod() { 17 } disallowedMethod()18 public void disallowedMethod() { 19 } 20 } 21 22 @Test(expected = org.mockito.exceptions.verification.NoInteractionsWanted.class) shouldFailBecauseDisallowedMethodWasCalled()23 public void shouldFailBecauseDisallowedMethodWasCalled(){ 24 SomeMethods someMethods = mock(SomeMethods.class); 25 26 someMethods.allowedMethod(); 27 someMethods.disallowedMethod(); 28 29 verify(someMethods, atLeast(1)).allowedMethod(); 30 verifyNoMoreInteractions(someMethods); 31 } 32 } 33