@Test public void testCombined() { int boxId = insertVocabularyBox( "defaultBox", "English", "German", VocabularyBox.TRANSLATION_DIRECTION_RANDOM); VocabularyBoxCursor boxCursor = new VocabularyBoxCursor( contentProvider.query( RememberMeProvider.VocabularyBox.VOCABULARY_BOXES, null, null, null, null)); assertTrue(boxCursor.moveToFirst()); assertEquals(boxId, boxCursor.peek().id); boxCursor.close(); insertWord(boxId, 1, "porcupine", "Stachelschwein"); WordCursor wordCursor = new WordCursor( contentProvider.query(RememberMeProvider.Word.WORDS, null, null, null, null)); assertTrue(wordCursor.moveToFirst()); int wordId = wordCursor.peek().id; wordCursor.close(); wordCursor = new WordCursor( contentProvider.query( RememberMeProvider.Word.findById(wordId), null, null, null, null)); assertTrue(wordCursor.moveToFirst()); assertEquals(1, wordCursor.peek().compartment); wordCursor.close(); }
@Test public void testVocabularyBox() { VocabularyBoxCursor boxCursor = new VocabularyBoxCursor( contentProvider.query( RememberMeProvider.VocabularyBox.VOCABULARY_BOXES, null, null, null, null)); assertFalse(boxCursor.moveToFirst()); boxCursor.close(); insertVocabularyBox( "defaultBox", "English", "German", VocabularyBox.TRANSLATION_DIRECTION_RANDOM); boxCursor = new VocabularyBoxCursor( contentProvider.query( RememberMeProvider.VocabularyBox.VOCABULARY_BOXES, null, null, null, null)); assertTrue(boxCursor.moveToFirst()); VocabularyBox box = boxCursor.peek(); assertEquals("defaultBox", box.name); assertEquals("English", box.foreignLanguage); assertEquals("German", box.nativeLanguage); assertEquals(VocabularyBox.TRANSLATION_DIRECTION_RANDOM, box.translationDirection); assertFalse(box.isCurrent); assertFalse(boxCursor.moveToNext()); boxCursor.close(); }