gordonad / powermock

Automatically exported from code.google.com/p/powermock
0 stars 0 forks source link

Only mock specific calls to new #11

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Let's say you have a method like this:

private Target createTarget(ITarget target) {
        Target domainTarget = null;
        try {
            domainTarget = new Target(getTargetName(target), target.getId());
        } catch (CreationException e) {
            domainTarget = new Target("Unknown", -1);
        }
        return domainTarget;
}

In one case here we'd like to mock the first instance creation of Target
and throw a CreationException but we'd like to make sure that a new Target
has been created with parameters "Unknown" and -1. This is not possible today.

Original issue reported on code.google.com by johan.ha...@gmail.com on 11 Sep 2008 at 9:03

GoogleCodeExporter commented 9 years ago

Original comment by johan.ha...@gmail.com on 3 Nov 2008 at 1:16

GoogleCodeExporter commented 9 years ago

Original comment by johan.ha...@gmail.com on 18 May 2009 at 7:00