@Test public void testSetTextChars_EmptyArray() { char[] expected = new char[0]; text.setTextChars(expected); char[] result = text.getTextChars(); assertEquals(0, result.length); assertEquals("", text.getText()); }
@Test public void testGetTextChars_FromText() { String string = "new string"; text.setText(string); char[] result = text.getTextChars(); for (int i = 0; i < string.length(); i++) { assertEquals(string.charAt(i), result[i]); } }
@Test public void testSetTextChars() { char[] expected = new char[] {'p', 'a', 's', 's', 'w', 'o', 'r', 'd'}; text.setTextChars(expected); char[] result = text.getTextChars(); assertEquals(expected.length, result.length); for (int i = 0; i < expected.length; i++) { assertEquals(expected[i], result[i]); } assertEquals("password", text.getText()); }