Commits

kulti committed e66128f

BookState.openFile test

Comments (0)

Files changed (1)

pdf_book_reader_test/src/ru/homeless/kulti/pdf_book_reader/test/BookStateTest.java

 {
     private class IBookViewStub implements IBookView
     {
+        public int setPageContentCallCount = 0;
+
         @Override
         public void setPageContent(String text)
         {
+            ++setPageContentCallCount;
         }
     };
     
+    private IBookViewStub bookView;
     private BookState bookState;
 
     public BookStateTest()
     public void setUp() throws Exception
     {
         super.setUp();
-        bookState = new BookState(new IBookViewStub());
+        bookView = new IBookViewStub();
+        bookState = new BookState(bookView);
     }
     
     public void testPageNavigation()
         assertEquals(2, bookState.currentPageNumber());
         bookState.goToPreviousPage();
         assertEquals(1, bookState.currentPageNumber());
-        
+    }
+    
+    public void testOpenFile()
+    {
+        bookState.openFile("/sdcard/test.pdf");
+        assertEquals(1, bookView.setPageContentCallCount);
     }
 }