Exemplo n.º 1
0
 @Test
 public void testSetTextChars_EmptyArray() {
   char[] expected = new char[0];
   text.setTextChars(expected);
   char[] result = text.getTextChars();
   assertEquals(0, result.length);
   assertEquals("", text.getText());
 }
Exemplo n.º 2
0
 @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]);
   }
 }
Exemplo n.º 3
0
 @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());
 }