All Downloads are FREE. Search and download functionalities are using the official Maven repository.

mockit.Mock Maven / Gradle / Ivy

Go to download

JMockit is a Java toolkit for automated developer testing. It contains APIs for the creation of the objects to be tested, for mocking dependencies, and for faking external APIs; JUnit (4 & 5) and TestNG test runners are supported. It also contains an advanced code coverage tool.

There is a newer version: 1.49
Show newest version
/*
 * Copyright (c) 2006 Rogério Liesenfeld
 * This file is subject to the terms of the MIT license (see LICENSE.txt).
 */
package mockit;

import java.lang.annotation.*;

/**
 * Used inside a {@linkplain MockUp fake} class to indicate a fake method whose implementation will temporarily
 * replace the implementation of a matching "real" method.
 * 

* The fake method must have the same name and the same parameters as the matching real method, except for an optional * first parameter of type {@link Invocation}; if this extra parameter is present, the remaining ones must match the * parameters in the real method. * The fake method must also have the same return type as the matching real method. *

* Method modifiers (public, final, static, etc.) between fake and faked methods * don't have to be the same. * It's perfectly fine to have a non-static fake method for a static faked method (or vice-versa), * for example. * Checked exceptions in the throws clause (if any) can also differ between the two matching methods. *

* A fake method can also target a constructor, in which case the previous considerations still apply, * except for the name of the fake method which must be "$init". *

* Another special fake method, "void $clinit()", will target the static * initializers of the faked class, if present in the fake class. *

* Yet another special fake method is "Object $advice(Invocation)", which if defined will * match every method in the target class hierarchy. * * @see Tutorial */ @Inherited @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.METHOD) public @interface Mock { }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy