@Test public void inputTest3() { m.updateSignature(2); m.updateSignature(9); m.updateSignature(8); m.updateSignature(9); m.updateSignature(8); m.updateSignature(3); // if we keep pressing when there's no more corresponding words, m.updateSignature(7); // the signature will not get updated String expected = "29898"; String result = m.getCurrentSignature(); assertEquals(expected, result); }
@Test public void deleteTest2() { m.updateSignature(2); m.updateSignature(7); m.updateSignature(7); m.updateSignature(5); m.updateSignature(3); // apple m.removeLastSignature(); m.removeLastSignature(); String expected = "277"; String result = m.getCurrentSignature(); assertEquals(expected, result); }
@Test public void entryTest2() { m.updateSignature(3); m.insertWord(); m.updateSignature(2); m.insertWord(); ArrayList<StringBuffer> expected = new ArrayList<StringBuffer>(); expected.add(new StringBuffer("d")); expected.add(new StringBuffer("a")); ArrayList<StringBuffer> result = m.getTexts(); for (int i = 0; i < expected.size(); i++) { assertEquals(expected.get(i).toString(), result.get(i).toString()); } }
@Test public void inputTest2() { m.updateSignature(2); String expected = "2"; String result = m.getCurrentSignature(); assertEquals(expected, result); }
@Test public void deleteTest3() { // if we do a deletion and there's no signature we are working on, // it should go back to the previously typed word m.updateSignature(2); m.updateSignature(3); m.insertWord(); m.updateSignature(2); m.updateSignature(2); m.insertWord(); m.removeLastSignature(); // this delete will go back to the previously // inserted word ArrayList<StringBuffer> expectedList = new ArrayList<StringBuffer>(); expectedList.add(new StringBuffer("ad")); String expectedSig = "22"; ArrayList<StringBuffer> resultList = m.getTexts(); String resultSig = m.getCurrentSignature(); for (int i = 0; i < expectedList.size(); i++) { assertEquals(expectedList.get(i).toString(), resultList.get(i).toString()); } assertEquals(expectedSig, resultSig); }