Search in sources :

Example 6 with EditorWrapper

use of nl.tudelft.watchdog.eclipse.logic.document.EditorWrapper in project watchdog by TestRoots.

the class IntervalJsonConverterTest method testJsonTypingIntervalDiffsAddition.

@Test
public void testJsonTypingIntervalDiffsAddition() {
    ITextEditor editor = Mockito.mock(ITextEditor.class);
    TypingInterval interval = new TypingInterval(new EditorWrapper(editor), new Date(1));
    interval.setDocument(new Document("Project", "filepath", "Production.java", "blah-document"));
    interval.setEndingDocument(new Document("Project", "filepath", "Production.java", "blah-document-add"));
    interval.close();
    sleepABit();
    ArrayList<WatchDogItem> intervals = new ArrayList<>();
    intervals.add(interval);
    assertEquals("[{\"endingDocument\":{\"pn\":\"f6f4da8d93e88a08220e03b7810451d3ba540a34\",\"fn\":\"e4afa075bb910c8ecb427e9950426a4599b21d7e\",\"sloc\":1,\"dt\":\"un\"},\"diff\":4,\"modCountDiff\":0,\"charLengthDiff\":4,\"doc\":{\"pn\":\"f6f4da8d93e88a08220e03b7810451d3ba540a34\",\"fn\":\"e4afa075bb910c8ecb427e9950426a4599b21d7e\",\"sloc\":1,\"dt\":\"un\"},\"it\":\"ty\",\"ts\":1," + pasteWDVAndClient() + "}]", transferer.toJson(intervals));
}
Also used : ITextEditor(org.eclipse.ui.texteditor.ITextEditor) TypingInterval(nl.tudelft.watchdog.core.logic.interval.intervaltypes.TypingInterval) EditorWrapper(nl.tudelft.watchdog.eclipse.logic.document.EditorWrapper) ArrayList(java.util.ArrayList) Document(nl.tudelft.watchdog.core.logic.document.Document) Date(java.util.Date) WatchDogItem(nl.tudelft.watchdog.core.logic.storage.WatchDogItem) Test(org.junit.Test)

Aggregations

Date (java.util.Date)6 TypingInterval (nl.tudelft.watchdog.core.logic.interval.intervaltypes.TypingInterval)6 WatchDogItem (nl.tudelft.watchdog.core.logic.storage.WatchDogItem)6 EditorWrapper (nl.tudelft.watchdog.eclipse.logic.document.EditorWrapper)6 ITextEditor (org.eclipse.ui.texteditor.ITextEditor)6 Test (org.junit.Test)6 Document (nl.tudelft.watchdog.core.logic.document.Document)5 ArrayList (java.util.ArrayList)4