Search in sources :

Example 6 with AnalyzeSources

use of main.Analyze.AnalyzeSources in project Info-Evaluation by TechnionYP5777.

the class AnalyzeSourcesTest method testAddSourceFile.

@Test
public void testAddSourceFile() {
    boolean check = false;
    final AnalyzeSources as = new AnalyzeSources();
    try {
        as.addSourceFile((Resources.getResource("text3.txt") + "").replace("file:", ""));
    } catch (Exception e) {
        check = true;
    }
    assert check;
    try {
        as.addSourceFile((Resources.getResource("text1.txt") + "").replace("file:", ""), "2013");
        ArrayList<TableTuple> details = as.getData().getList();
        assert "Tito Ortiz".equals(details.get(0).getName());
        assert "01/06/2013".equals(details.get(0).getDate());
        assert "driving under influence".equals(details.get(0).getReason());
        as.addSourceFile((Resources.getResource("text2.txt") + "").replace("file:", ""));
        details = as.getData().getList();
        assert "Mark Salling".equals(details.get(3).getName());
        assert "12/29/2016".equals(details.get(3).getDate());
        assert "possession of pornography".equals(details.get(3).getReason());
    } catch (IOException e) {
        fail();
    }
}
Also used : TableTuple(main.database.TableTuple) AnalyzeSources(main.Analyze.AnalyzeSources) IOException(java.io.IOException) IOException(java.io.IOException) Test(org.junit.Test)

Aggregations

AnalyzeSources (main.Analyze.AnalyzeSources)6 TableTuple (main.database.TableTuple)4 Test (org.junit.Test)4 IOException (java.io.IOException)2 GroupLayout (javax.swing.GroupLayout)2 JButton (javax.swing.JButton)2 JFrame (javax.swing.JFrame)2 JTable (javax.swing.JTable)2 JTextField (javax.swing.JTextField)2 LineBorder (javax.swing.border.LineBorder)2 DefaultTableModel (javax.swing.table.DefaultTableModel)2 Color (java.awt.Color)1 Dimension (java.awt.Dimension)1 Point (java.awt.Point)1 WindowEvent (java.awt.event.WindowEvent)1 BufferedImage (java.awt.image.BufferedImage)1 SQLException (java.sql.SQLException)1 ArrayList (java.util.ArrayList)1 ImageIcon (javax.swing.ImageIcon)1 JCheckBox (javax.swing.JCheckBox)1