### Question:
CommonUtils { public static SSLContext createNoSSLContext() { SSLContext ssl_ctx = null; try { ssl_ctx = SSLContext.getInstance("TLS"); } catch (NoSuchAlgorithmException e) { } TrustManager[] trust_mgr = new TrustManager[] { new X509TrustManager() { public X509Certificate[] getAcceptedIssuers() { return null; } public void checkClientTrusted(X509Certificate[] certs, String t) { } public void checkServerTrusted(X509Certificate[] certs, String t) { } } }; try { ssl_ctx.init(null, trust_mgr, new SecureRandom()); } catch (KeyManagementException e) { } return ssl_ctx; } private  CommonUtils(); @SuppressWarnings("unchecked") static Map<String, Object> flatNestedMap(String notation, Map<String, Object> nestedMap); static String buildErrorResponse(Exception e); static String convertAttributetoKeyword(String attributeName); @SuppressWarnings("unchecked") static LinkedHashMap<String, Object> flatNestedLinkedHashMap(String notation, Map<String, Object> nestedMap); static Object filterMatchingCollectionElements(Object obj, String pattern, boolean retainInsteadOfFilter); static SSLContext createNoSSLContext(); static String capitailizeWord(String mainStr); static String getEnvironmentForTag(String key);  }### Answer:
@Test public void createNoSSLContext() throws NoSuchAlgorithmException { final SSLContext ssl_ctx = PowerMockito.mock(SSLContext.class); mockStatic(SSLContext.class); when(SSLContext.getInstance(anyString())).thenReturn(ssl_ctx); assertEquals(forTest.createNoSSLContext(), null); }
@SuppressWarnings("unchecked") @Test public void createNoSSLContext1() throws NoSuchAlgorithmException { mockStatic(SSLContext.class); when(SSLContext.getInstance(anyString())).thenThrow(NoSuchAlgorithmException.class); assertThatThrownBy(() -> forTest.createNoSSLContext()).isInstanceOf(NullPointerException.class); }
@SuppressWarnings("unchecked") @Test public void createNoSSLContext2() throws Exception { final SSLContext ssl_ctx = PowerMockito.mock(SSLContext.class); mockStatic(SSLContext.class); when(SSLContext.getInstance(anyString())).thenThrow(NoSuchAlgorithmException.class); PowerMockito.when(ssl_ctx, "init", anyObject(), anyObject(), anyObject()).thenThrow(KeyManagementException.class); assertThatThrownBy(() -> forTest.createNoSSLContext()).isInstanceOf(NullPointerException.class); }