### Question:
SpacewalkService { @SuppressWarnings("unchecked") public static List<SpacewalkChannel> getChannels(final Credentials credentials, final URL spacewalkBaseUrl) throws SpacewalkException { validateParameters(credentials, spacewalkBaseUrl); URL queryUrl = getQueryUrl(spacewalkBaseUrl); Object sessionKey = getSessionKey(credentials, queryUrl); XmlRpcClient client = createXmlRpcClient(queryUrl); List<SpacewalkChannel> channelList = new ArrayList<>(); try { Object[] rawChannels = (Object[]) client.execute("channel.listAllChannels", new Object[] {sessionKey}); for (Object channelObj : rawChannels) { Map<String, Object> channelMap = (Map<String, Object>) channelObj; SpacewalkChannel channel = new SpacewalkChannel(channelMap, spacewalkBaseUrl); channelList.add(channel); } LOGGER.info("Found " + rawChannels.length + " channels. Closing session"); closeSession(sessionKey, queryUrl); } catch (XmlRpcException e) { String message = "Error getting list of spacewalk channels: " + e.getMessage(); LOGGER.error(message, e); throw new SpacewalkException(message, e); } catch (IllegalArgumentException iae) { String message = "Error processing channel map returned from Spacewalk"; LOGGER.error(message, iae); throw new SpacewalkException(message, iae); } finally { closeSession(sessionKey, queryUrl); } return channelList; } private  SpacewalkService(); @SuppressWarnings("unchecked") static List<SpacewalkChannel> getChannels(final Credentials credentials,
            final URL spacewalkBaseUrl); @SuppressWarnings("unchecked") static List<SpacewalkPackage> getPackages(final Credentials credentials,
            final URL spacewalkBaseUrl, final String channelLabel,
            final Repository sourceRepository); static URL getPackageDownloadUrl(final Credentials credentials,
            final URL spacewalkBaseUrl, final SpacewalkPackage spacewalkPackage); static void testConnection(final Credentials credentials,
            final URL spacewalkBaseUrl);  }### Answer:
@Test( expectedExceptions = SpacewalkException.class, expectedExceptionsMessageRegExp = ".*credentials.*") public void exceptionWithNullAuthenticationChannels() throws SpacewalkException { SpacewalkService.getChannels(null, spacewalkBaseUrl); }
@Test( expectedExceptions = SpacewalkException.class, expectedExceptionsMessageRegExp = ".*Spacewalk URL.*") public void exceptionWithNullUrlChannels() throws SpacewalkException { SpacewalkService.getChannels(authentication, null); }
@Test( expectedExceptions = SpacewalkException.class, expectedExceptionsMessageRegExp = ".*https.*") public void exceptionWithNonHttpsUrl() throws SpacewalkException, MalformedURLException { SpacewalkService.getChannels(authentication, new URL("http: }
@Test( expectedExceptions = SpacewalkException.class, expectedExceptionsMessageRegExp = ".*Spacewalk session for " + SPACEWALK_BASE_URL_STRING + "/rpc/api.*") public void exceptionWithUnreachableSpacewalkChannels() throws SpacewalkException { SpacewalkService.getChannels(authentication, spacewalkBaseUrl); }