private static Instance getInstance(byte[] ipAddress, int dataPort, String hostname, int slots) throws Exception { HardwareDescription hardwareDescription = new HardwareDescription(4, 2L * 1024 * 1024 * 1024, 1024 * 1024 * 1024, 512 * 1024 * 1024); InstanceConnectionInfo connection = mock(InstanceConnectionInfo.class); when(connection.address()).thenReturn(InetAddress.getByAddress(ipAddress)); when(connection.dataPort()).thenReturn(dataPort); when(connection.getInetAdress()).thenReturn(InetAddress.getByAddress(ipAddress).toString()); when(connection.getHostname()).thenReturn(hostname); when(connection.getFQDNHostname()).thenReturn(hostname); return new Instance(taskManager, connection, new InstanceID(), hardwareDescription, slots); }