mirror of
https://github.com/MinimalBible/MinimalBible
synced 2025-08-02 05:24:51 -04:00
Fix issues the OsisParser regenerating VerseContent
BookManager is still currently unable to delete books
This commit is contained in:
@ -142,7 +142,7 @@ public class BookManagerTest extends MBTestCase implements Injector {
|
||||
|
||||
bookManager.getInstalledBooksList().add(mockBook);
|
||||
assertTrue(bookManager.getInstalledBooksList().contains(mockBook));
|
||||
bookManager.removeBook(mockBook);
|
||||
bookManager.removeBook(mockBook, driver);
|
||||
assertFalse(bookManager.getInstalledBooksList().contains(mockBook));
|
||||
verify(driver, times(1)).delete(mockBook);
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ import android.annotation.SuppressLint;
|
||||
import org.bspeice.minimalbible.MBTestCase;
|
||||
import org.bspeice.minimalbible.service.format.osisparser.OsisParser;
|
||||
import org.crosswire.jsword.book.OSISUtil;
|
||||
import org.crosswire.jsword.passage.Verse;
|
||||
import org.xml.sax.Attributes;
|
||||
|
||||
import static org.mockito.Mockito.mock;
|
||||
@ -48,4 +49,26 @@ public class OsisParserTest extends MBTestCase {
|
||||
parser.endElement("", "", "");
|
||||
assertTrue(parser.getDoWrite().isEmpty());
|
||||
}
|
||||
|
||||
// During initial development, I accidentally set up the verseContent
|
||||
// as a value computed every time - so you'd get a new "content" every time
|
||||
// you tried to update it. Thus, if you updated the content only once, you're fine.
|
||||
// Try and update multiple times, and things would start going crazy.
|
||||
@SuppressLint("NewApi")
|
||||
@SuppressWarnings("unused")
|
||||
public void ignoreTestVerseContentConsistent() {
|
||||
String string1 = "1";
|
||||
String string2 = "2";
|
||||
|
||||
// Yes, I need intimate knowledge of the state machine to run this test
|
||||
// Also, Verse is final, so I can't mock that, which is why this test is ignored.
|
||||
Verse mockVerse = mock(Verse.class);
|
||||
parser.setVerse(mockVerse);
|
||||
parser.getDoWrite().push(true);
|
||||
parser.characters(string1.toCharArray(), 0, string1.length());
|
||||
assertEquals(parser.getVerseContent().getContent(), string1);
|
||||
|
||||
parser.characters(string2.toCharArray(), 0, string2.length());
|
||||
assertEquals(parser.getVerseContent().getContent(), string1 + string2);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user