@Test public void testCopy() { engine.copy(); Assert.assertTrue("Copy() - Buffer isn't empty", buffer.getText().equals("")); Assert.assertTrue("Copy() - Clipboard isn't empty", clipboard.getText().equals("")); Assert.assertTrue( "Copy() - Selection isn't (0, 0)", selection.getStart() == 0 && selection.getLength() == 0); buffer.setText("test"); engine.copy(); Assert.assertTrue( "Copy() - Buffer content isn't the set text", buffer.getText().equals("test")); Assert.assertTrue("Copy() - Clipboard isn't empty", clipboard.getText().equals("")); Assert.assertTrue( "Copy() - Selection isn't (0, 0)", selection.getStart() == 0 && selection.getLength() == 0); selection.setStart(0); selection.setLength(4); engine.copy(); Assert.assertTrue( "Copy() - Buffer content isn't the set text", buffer.getText().equals("test")); Assert.assertTrue("Copy() - Clipboard is empty", clipboard.getText().equals("test")); Assert.assertTrue( "Copy() - Selection isn't (0, 4)", selection.getStart() == 0 && selection.getLength() == 4); selection.setLength(0); engine.copy(); Assert.assertTrue( "Copy() - Buffer content isn't the set text", buffer.getText().equals("test")); Assert.assertTrue( "Copy() - Clipboard is changed but copy when no text selected", clipboard.getText().equals("test")); Assert.assertTrue( "Copy() - Selection isn't (0, 0)", selection.getStart() == 0 && selection.getLength() == 0); }