CardFile { public LearnStatusSerializer getSerializer() { return serializer; } CardFile(File cardFileLocation); static SlideShow getSlideShow(CardFile cardFile); Collection<Category> belongsTo(); boolean addToCategory(Category c); boolean removeFromCategory(Category c); File getFileLocation(); String toString(); boolean equals(Object obj); FlashCardCollection getFlashCards(); boolean isDeserialized(); void setSerializer(LearnStatusSerializer serializer); LearnStatusSerializer getSerializer(); void flush(); boolean forceSync(); boolean synchronize(); CardFileProperties getProperties();  }
@Test public void loadHugeFile() { LearnStatusSerializer serializer = CardFileBackend.getBackend().getSerializer(); CardFile hugeCardFile = new CardFile(new File("testdata/Spanish1700.ppt")); FlashCardCollection flashCardCollection = serializer.readFlashcardsFromFile(hugeCardFile); System.err.println("done reading " + flashCardCollection.size() + "flashcards"); }
@Test public void readInvalidFile() { LearnStatusSerializer serializer = CardFileBackend.getBackend().getSerializer(); try { CardFile hugeCardFile = new CardFile(new File("testdata/chinese1.odp")); serializer.readFlashcardsFromFile(hugeCardFile); Assert.fail(); } catch (OfficeXmlFileException t) { System.err.println(t); } catch (Throwable t) { Assert.fail(); } }
@Test public void readInvalidFile2() { LearnStatusSerializer serializer = CardFileBackend.getBackend().getSerializer(); try { CardFile cardFile = new CardFile(new File("testdata/import/flashcards_ansi.txt")); serializer.readFlashcardsFromFile(cardFile); Assert.fail(); } catch (InvalidCardFileFormatException t) { System.err.println(t); } catch (Throwable t) { Assert.fail(); } }
@Test public void readPPTXInsteadOfPPT() { LearnStatusSerializer serializer = CardFileBackend.getBackend().getSerializer(); try { CardFile cardFile = new CardFile(new File("testdata/pptx_with_ppt_suffix.ppt")); serializer.readFlashcardsFromFile(cardFile); Assert.fail(); } catch (OfficeXmlFileException t) { System.err.println(t); } catch (Throwable t) { Assert.fail(); } }