RouterDeploymentDefinition { protected void checkPreconditions() throws ResourceUnavailableException { if (guestNetwork.getState() != Network.State.Implemented && guestNetwork.getState() != Network.State.Setup && guestNetwork.getState() != Network.State.Implementing) { throw new ResourceUnavailableException("Network is not yet fully implemented: " + guestNetwork, Network.class, guestNetwork.getId()); } if (guestNetwork.getTrafficType() != TrafficType.Guest) { throw new ResourceUnavailableException("Network is not type Guest as expected: " + guestNetwork, Network.class, guestNetwork.getId()); } } protected  RouterDeploymentDefinition(final Network guestNetwork, final DeployDestination dest,
                                         final Account owner, final Map<Param, Object> params); Long getServiceOfferingId(); Vpc getVpc(); Network getGuestNetwork(); DeployDestination getDest(); Account getOwner(); Map<Param, Object> getParams(); boolean isRedundant(); DeploymentPlan getPlan(); boolean isVpcRouter(); Pod getPod(); Long getPodId(); List<DomainRouterVO> getRouters(); VirtualRouterProvider getVirtualProvider(); boolean isBasic(); boolean isPublicNetwork(); PublicIp getSourceNatIP(); boolean needsPublicNic(); boolean hasSourceNatService(); List<DomainRouterVO> deployVirtualRouter();  }
@Test public void testCheckPreconditions() throws ResourceUnavailableException { final Network.State states[] = { Network.State.Implemented, Network.State.Setup, Network.State.Implementing }; when(deployment.guestNetwork.getTrafficType()).thenReturn(TrafficType.Guest); for (final Network.State state : states) { driveTestCheckPreconditionsCorrectNwState(state); } }