@SmallTest public void testGetValuesThrowsNullPointerExceptionIfTagIsNull() { try { mapper.getValues(null); fail("No exception has been thrown"); } catch (NullPointerException e) { assertNotNull(e); } }
@SmallTest public void testMapThrowsNullPointerExceptionIfNoCursorProvided() { try { mapper.map(null); fail("No exception has been thrown."); } catch (NullPointerException e) { assertNotNull(e); } }
@SmallTest public void testGetValuesReturnsCorrectValues() { // Given UUID id = randomUUID(); String name = "Food"; Tag tag = new Tag(id, name); // When ContentValues values = mapper.getValues(tag); // Then assertNotNull(values); assertEquals(id.toString(), values.get(ID)); assertEquals(name, values.get(NAME)); }
@SmallTest public void testMapMapsTagCorrectly() { // Given String id = randomUUID().toString(); String name = "food"; Cursor c = createTagCursor(id, name); // When Tag tag = mapper.map(c); // Then assertNotNull(tag); assertEquals(id, tag.getId().toString()); assertEquals(name, tag.getName()); }