/** @throws java.lang.Exception */ @Before public void setUp() throws Exception { p = new Paper(new File("test1.txt"), "Janelle", new Conference()); c = new Conference(); u = new User("janelle", 1, c); FileWriter.writeSerializable(p, p.getFileSerialName()); FileWriter.writeSerializable(u, u.getFileSerialName()); }
@Test public void test() { Paper q = null; User v = null; try { q = (Paper) FileWriter.deSerializable("P_" + p.getFileSerialName()); v = (User) FileWriter.deSerializable("U_" + u.getFileSerialName()); } catch (FileNotFoundException e) { e.printStackTrace(); } assert (u.getUserName().equals(v.getUserName())); assert (q.getAuthor().equals(p.getAuthor())); assert (q.getPaper().equals(p.getPaper())); }