import java.io.*; public class Part1Tester{ public static void main(String[] args){ SentencePart1 sent1 = new SentencePart1("@stellargirl I loooooooovvvvvveee my Kindle2. Not that the DX is cool," +" but the 2 is fantastic in its own right.", "tpryan", "Mon May 11 03:17:40 UTC 2009"); boolean test1 = sent1.getText().equals("@stellargirl I loooooooovvvvvveee my Kindle2. Not that the DX is cool," +" but the 2 is fantastic in its own right."); boolean test2 = sent1.getAuthor().equals("tpryan"); boolean test3 = sent1.getTimestamp().equals("Mon May 11 03:17:40 UTC 2009"); sent1.setText("Hello world!"); boolean test4 = sent1.getText().equals("Hello world!"); boolean test5 = sent1.getAuthor().equals("tpryan"); boolean test6 = sent1.getTimestamp().equals("Mon May 11 03:17:40 UTC 2009"); sent1.setAuthor("AdaLovelace"); boolean test7 = sent1.getText().equals("Hello world!"); boolean test8 = sent1.getAuthor().equals("AdaLovelace"); boolean test9 = sent1.getTimestamp().equals("Mon May 11 03:17:40 UTC 2009"); sent1.setTimestamp("Mon May 11 03:17:40 UTC 1843"); boolean test10 = sent1.getText().equals("Hello world!"); boolean test11 = sent1.getAuthor().equals("AdaLovelace"); boolean test12 = sent1.getTimestamp().equals("Mon May 11 03:17:40 UTC 1843"); String result = "{author:AdaLovelace, sentence:\"Hello world!\", timestamp:\"Mon May 11 03:17:40 UTC 1843\"}"; boolean test13 = result.equals(sent1.toString()); int count = 0; System.out.println("test1: " + test1); if (test1) count++; System.out.println("test2: " + test2); if (test2) count++; System.out.println("test3: " + test3); if (test3) count++; System.out.println("test4: " + test4); if (test4) count++; System.out.println("test5: " + test5); if (test5) count++; System.out.println("test6: " + test6); if (test6) count++; System.out.println("test7: " + test7); if (test7) count++; System.out.println("test8: " + test8); if (test8) count++; System.out.println("test9: " + test9); if (test9) count++; System.out.println("test10: " + test10); if (test10) count++; System.out.println("test11: " + test11); if (test11) count++; System.out.println("test12: " + test12); if (test12) count++; System.out.println("test13: " + test13); if (test13) count++; String expected = "19/2020 0:00,,RJJJJJJJIshak,\"GlblCtzn, priyankachopra\",Jakarta Capital Region,call leader help protect refuge covid19 provid qualiti health care\n" + "0,61,4/19/2020 0:00,,makinwaoluwole,OGSG_Official,Nigeria,ogun state support cbn nirsal covid19 target credit facil tcf\n" + "0,1,4/19/2020 0:00,,TembeAmu,AdvoBarryRoux,,polic offici base namahadi polic station busi drink liquor certain tavern whilst duti\n" + "0,0,4/19/2020 0:00,,ilyasrabiu,MobilePunch,\"Lagos, Nigeria\",covid19 oyo discharg two patient\n" + "0,13869,4/19/2020 0:00,Covid_19,bucketeconomist,,,condol famili surviv\n" + "0,526,4/19/2020 0:00,,rohaniroop,DrJMZimmerman,\"British Columbia, Canada\",receiv text year old son work covid19 patient equat quarantin com\n" + "0,119,4/19/2020 0:00,,agostinhozinga,,\"London, England\",taiwan vice presid chen chien jen countri fight covid19\n" + "0,474,4/19/2020 0:00,coronavirus,DrJeffreyPOlson,morethanmySLE,JPO Aesthetics,break new york woman symptom die last week prescrib drug cocktail known\n" + "0,23,4/19/2020 0:00,,MichelleCarbe"; StringBuffer contents = new StringBuffer(); try { BufferedWriter file = new BufferedWriter(new FileWriter("covid_10K_test.csv")); file.write(expected); file.close(); DriverPart1.readTwitterData(contents, "covid_10K_test.csv"); } catch (IOException err1) { } boolean mismatch = false; for(int i = 0; i < expected.length(); i++){ if(contents.substring(0,996).charAt(i) != expected.charAt(i)){ mismatch = true; System.out.println(i + " " + contents.substring(0,996).charAt(i) + " " + expected.charAt(i)); } } if (mismatch == false){ count += 5; System.out.println("csv contents matched: true"); } else System.out.println("csv contents matched: false"); System.out.println("\n***YOUR SCORE ON THIS ASSIGNMENT: ( " + count + " ) out of 18 total***\n"); //submission String command = "tar -cvf Part1.tar DriverPart1.java SentencePart1.java"; try { Process process = Runtime.getRuntime().exec(command); } catch (Exception excep) { excep.printStackTrace(); System.out.println("ERROR creating tarfile -- make sure you have tar utility installed"); } } }