/** Test of setPassword method, of class InvokeCommandLine. */ @Test public void testSetPassword() throws NoSuchFieldException, IllegalArgumentException, IllegalAccessException { System.out.println("setPassword"); String password = "******"; instance = new InvokeCommandLine(); instance.setPassword(password); Field field2 = instance.getClass().getDeclaredField("password"); field2.setAccessible(true); assertEquals(password, field2.get(instance)); }
/** Test of setSSID method, of class InvokeCommandLine. */ @Test public void testSetSSID() throws IllegalArgumentException, IllegalAccessException, NoSuchFieldException { System.out.println("setSSID"); String SSID = "Test"; instance = new InvokeCommandLine(); instance.setSSID(SSID); Field field = instance.getClass().getDeclaredField("SSID"); field.setAccessible(true); assertEquals(SSID, field.get(instance)); }
/** Test of InvokeCommandLine method, of class InvokeCommandLine. */ @Test public void testInvokeCommandLine_0args() throws NoSuchFieldException, IllegalArgumentException, IllegalAccessException { System.out.println("InvokeCommandLine"); instance = new InvokeCommandLine(); Field field = instance.getClass().getDeclaredField("SSID"); field.setAccessible(true); assertEquals("", field.get(instance)); Field field2 = instance.getClass().getDeclaredField("password"); field2.setAccessible(true); assertEquals("", field2.get(instance)); }
/** Test of InvokeCommandLine method, of class InvokeCommandLine. */ @Test public void testInvokeCommandLine_String_String() throws IllegalArgumentException, IllegalAccessException, NoSuchFieldException { System.out.println("InvokeCommandLine"); String SSID = "test"; String password = "******"; instance = new InvokeCommandLine(SSID, password); Field field = instance.getClass().getDeclaredField("SSID"); field.setAccessible(true); assertEquals(SSID, field.get(instance)); Field field2 = instance.getClass().getDeclaredField("password"); field2.setAccessible(true); assertEquals(password, field2.get(instance)); }
/** Test of invoke method, of class InvokeCommandLine. */ @Test public void testInvoke() { System.out.println("invoke"); ByteArrayOutputStream out = new ByteArrayOutputStream(); System.setOut(new PrintStream(out)); String expectedOutput = "ABCDEFG"; String[] commandAndArgs = {"echo", expectedOutput}; instance = new InvokeCommandLine(); instance.invoke(commandAndArgs); String whatWasWritten = out.toString().trim(); assertEquals(expectedOutput, whatWasWritten); }