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.junit; 6 7 import org.mockito.Incubating; 8 import org.mockito.internal.junit.JUnitRule; 9 import org.mockito.internal.junit.VerificationCollectorImpl; 10 import org.mockito.internal.util.ConsoleMockitoLogger; 11 import org.mockito.quality.Strictness; 12 13 /** 14 * Mockito supports JUnit via: 15 * <li> 16 * <ul>JUnit Rules - see {@link MockitoRule}</ul> 17 * <ul>JUnit runners - see {@link MockitoJUnitRunner}</ul> 18 * <ul><a href="http://javadoc.io/page/org.mockito/mockito-junit-jupiter/latest/org/mockito/junit/jupiter/MockitoExtension.html">JUnit Jupiter extension</a></ul> 19 * </li> 20 * 21 * @since 1.10.17 22 */ 23 public class MockitoJUnit { 24 25 /** 26 * Creates rule instance that initiates @Mocks 27 * For more details and examples see {@link MockitoRule}. 28 * 29 * @return the rule instance 30 * @since 1.10.17 31 */ rule()32 public static MockitoRule rule() { 33 return new JUnitRule(new ConsoleMockitoLogger(), Strictness.WARN); 34 } 35 36 /** 37 * Creates a rule instance that can perform lazy verifications. 38 * 39 * @see VerificationCollector 40 * @return the rule instance 41 * @since 2.1.0 42 */ 43 @Incubating collector()44 public static VerificationCollector collector() { 45 return new VerificationCollectorImpl(); 46 } 47 } 48