Skip to content
Permalink
Browse files

Added unit test for Line Length event driver

  • Loading branch information...
DavidBerdik committed May 30, 2019
1 parent 39f8749 commit 055b7ba5f757a1aa59d9b6c6bff7bc357fa36afc
Showing with 46 additions and 0 deletions.
  1. +46 −0 unittests/com/jgaap/eventDrivers/LineLengthEventDriverTest.java
@@ -0,0 +1,46 @@
package com.jgaap.eventDrivers;

import static org.junit.Assert.assertTrue;

import org.junit.Test;

import com.jgaap.util.Event;
import com.jgaap.util.EventSet;

/**
*
* @author David Berdik
*
*/
public class LineLengthEventDriverTest {
@Test
public void testCreateEventDocumentSet() {
LineLengthEventDriver eventDriver = new LineLengthEventDriver();

String sampleInput = "There once was a man from Nantucket\n" +
"Who kept all his cash in a bucket.\n" +
" But his daughter, named Nan,\n" +
" Ran away with a man\n" +
"And as for the bucket, Nantucket.\n" +
"\n" +
"But he followed the pair to Pawtucket,\n" +
"The man and the girl with the bucket;\n" +
" And he said to the man,\n" +
" He was welcome to Nan,\n" +
"But as for the bucket, Pawtucket.\n" +
"\n" +
"Then the pair followed Pa to Manhasset,\n" +
"Where he still held the cash as an asset,\n" +
" But Nan and the man\n" +
" Stole the money and ran,\n" +
"And as for the asset, Manhasset.";
EventSet actualSet = eventDriver.createEventSet(sampleInput.toCharArray());

EventSet expectedSet = new EventSet();
int[] expectedVals = {7, 8, 5, 5, 6, 7, 8, 6, 5, 6, 7, 9, 5, 5, 6};
for (int val : expectedVals)
expectedSet.addEvent(new Event(Integer.toString(val), eventDriver));

assertTrue(expectedSet.equals(actualSet));
}
}

0 comments on commit 055b7ba

Please sign in to comment.
You can’t perform that action at this time.