Buggy code:
public class MockVMSupport extends AbstractVMSupport < MockCloud > implements VirtualMachineSupport { static class MonitorCounter { private Random random ; private boolean counting ; private int threshold ; private int start ; private int count ; public MonitorCounter ( int threshold , int start ) { } public void start ( ) { } public boolean count ( ) { } public boolean isCounting ( ) { } } private static class MockVM { public String vmId ; public String name ; public String description ; public String userData ; public VmState currentState ; public long created ; public String imageId ; public long lastBoot ; public long lastPaused ; public long lastTouched ; public Platform platform ; public String owner ; public String privateIpAddress ; public String publicIpAddress ; public String productId ; public String vlanId ; public String subnetId ; public String rootUser ; public String rootPassword ; public String shellKey ; public MockVMSupport . MonitorCounter counter = new MockVMSupport . MonitorCounter ( 100 , 0 ) ; } private static final HashMap < String , Map < String , Map < String , Collection < MockVMSupport . MockVM > > > > mockList = new HashMap < String , Map < String , Map < String , Collection < MockVMSupport . MockVM > > > > ( ) ; private static Thread monitor ; private static long nextId = 1 ; private static int quad1 = 10 ; private static int quad2 = 0 ; private static int quad3 = 0 ; private static int quad4 = 0 ; public static String [ ] getNextIpPair ( ) throws CloudException { } @ Nonnull private static String getNextId ( @ Nonnull String regionId ) { } @ Nullable private static MockVMSupport . MockVM getMockVM ( @ Nonnull ProviderContext ctx , @ Nonnull String vmId ) { } private static void checkMonitor ( ) { } private static final Random random = new Random ( ) ; private static void monitor ( ) { } public MockVMSupport ( MockCloud provider ) { } @ Nonnull @ Override public VirtualMachineCapabilities getCapabilities ( ) throws CloudException , InternalException { <START_BUG> return new MockVMCapabilities ( getProvider ( ) ) ; <END_BUG> } @ Override public boolean isSubscribed ( ) throws CloudException , InternalException { } @ Override @ Nonnull public VirtualMachine launch ( @ Nonnull VMLaunchOptions withLaunchOptions ) throws CloudException , InternalException { } @ Override @ Nonnull public Iterable < String > listFirewalls ( @ Nonnull String vmId ) throws CloudException , InternalException { } @ Override @ Nullable public String getUserData ( @ Nonnull String vmId ) throws CloudException , InternalException { } @ Override @ Nonnull public Iterable < VirtualMachine > listVirtualMachines ( ) throws CloudException , InternalException { } @ Override public void pause ( @ Nonnull String vmId ) throws CloudException , InternalException { } @ Override public void reboot ( @ Nonnull String vmId ) throws CloudException , InternalException { } @ Override public void resume ( @ Nonnull String vmId ) throws CloudException , InternalException { } @ Override public void start ( @ Nonnull String vmId ) throws CloudException , InternalException { } @ Override public void stop ( @ Nonnull String vmId , boolean force ) throws CloudException , InternalException { } @ Override public void suspend ( @ Nonnull String vmId ) throws CloudException , InternalException { } @ Override public void terminate ( @ Nonnull String vmId ) throws CloudException , InternalException { } @ Override public void terminate ( @ Nonnull String vmId , @ Nullable String explanation ) throws CloudException , InternalException { } @ Override public void unpause ( @ Nonnull String vmId ) throws CloudException , InternalException { } @ Nullable private VirtualMachine toVM ( @ Nonnull String dcId , @ Nullable MockVMSupport . MockVM mock ) throws CloudException { } No newline ; at end ; of file ; }

Fix:
return getProvider ( ) . getCapabilitiesFactory ( ) . getCapabilities ( MockVMCapabilities . class ) ;