public ContentValuesAssert containsValue(Object expectedValue) { isNotNull(); Set<Map.Entry<String, Object>> entries = actual.valueSet(); List<Object> values = new ArrayList<Object>(entries.size()); for (Map.Entry<String, Object> entry : entries) { values.add(entry.getValue()); } assertThat(values) .overridingErrorMessage("Expected <%s> but was not found.", expectedValue) .contains(expectedValue); return this; }
/** * This method iterates through a set of expected values and makes various assertions that * will pass if our app is functioning properly. * * @param error Message when an error occurs * @param valueCursor The Cursor containing the actual values received from an arbitrary query * @param expectedValues The values we expect to receive in valueCursor */ static void validateCurrentRecord(String error, Cursor valueCursor, ContentValues expectedValues) { Set<Map.Entry<String, Object>> valueSet = expectedValues.valueSet(); for (Map.Entry<String, Object> entry : valueSet) { String columnName = entry.getKey(); int index = valueCursor.getColumnIndex(columnName); /* Test to see if the column is contained within the cursor */ String columnNotFoundError = "Column '" + columnName + "' not found. " + error; assertFalse(columnNotFoundError, index == -1); /* Test to see if the expected value equals the actual value (from the Cursor) */ String expectedValue = entry.getValue().toString(); String actualValue = valueCursor.getString(index); String valuesDontMatchError = "Actual value '" + actualValue + "' did not match the expected value '" + expectedValue + "'. " + error; assertEquals(valuesDontMatchError, expectedValue, actualValue); } }
/** * This method iterates through a set of expected values and makes various assertions that * will pass if our app is functioning properly. * * @param error Message when an error occurs * @param valueCursor The Cursor containing the actual values received from an arbitrary query * @param expectedValues The values we expect to receive in valueCursor */ static void validateCurrentRecord(String error, Cursor valueCursor, ContentValues expectedValues) { Set<Map.Entry<String, Object>> valueSet = expectedValues.valueSet(); for (Map.Entry<String, Object> entry : valueSet) { String columnName = entry.getKey(); int index = valueCursor.getColumnIndex(columnName); /* Test to see if the column is contained within the cursor */ String columnNotFoundError = "Column '" + columnName + "' not found. " + error; assertFalse(columnNotFoundError, index == -1); /* Test to see if the expected value equals the actual value (from the Cursor) */ String expectedValue = entry.getValue().toString(); String actualValue = valueCursor.getString(index); String valuesDontMatchError = "Actual value '" + actualValue + "' did not match the expected value '" + expectedValue + "'. " + error; assertEquals(valuesDontMatchError, expectedValue, actualValue); } }
/** * This method iterates through a set of expected values and makes various assertions that * will pass if our app is functioning properly. * * @param error Message when an error occurs * @param valueCursor The Cursor containing the actual values received from an arbitrary query * @param expectedValues The values we expect to receive in valueCursor */ static void validateCurrentRecord(String error, Cursor valueCursor, ContentValues expectedValues) { Set<Map.Entry<String, Object>> valueSet = expectedValues.valueSet(); for (Map.Entry<String, Object> entry : valueSet) { String columnName = entry.getKey(); int index = valueCursor.getColumnIndex(columnName); /* Test to see if the column is contained within the cursor */ String columnNotFoundError = "Column '" + columnName + "' not found. " + error; assertFalse(columnNotFoundError, index == -1); /* Test to see if the expected value equals the actual value (from the Cursor) */ String expectedValue = entry.getValue().toString(); String actualValue = valueCursor.getString(index); String valuesDontMatchError = "Actual value '" + actualValue + "' did not match the expected value '" + expectedValue + "'. " + error; assertEquals(valuesDontMatchError, expectedValue, actualValue); } }
/** * This method iterates through a set of expected values and makes various assertions that * will pass if our app is functioning properly. * * @param error Message when an error occurs * @param valueCursor The Cursor containing the actual values received from an arbitrary query * @param expectedValues The values we expect to receive in valueCursor */ static void validateCurrentRecord(String error, Cursor valueCursor, ContentValues expectedValues) { Set<Map.Entry<String, Object>> valueSet = expectedValues.valueSet(); for (Map.Entry<String, Object> entry : valueSet) { String columnName = entry.getKey(); int index = valueCursor.getColumnIndex(columnName); /* Test to see if the column is contained within the cursor */ String columnNotFoundError = "Column '" + columnName + "' not found. " + error; assertFalse(columnNotFoundError, index == -1); /* Test to see if the expected value equals the actual value (from the Cursor) */ String expectedValue = entry.getValue().toString(); String actualValue = valueCursor.getString(index); String valuesDontMatchError = "Actual value '" + actualValue + "' did not match the expected value '" + expectedValue + "'. " + error; assertEquals(valuesDontMatchError, expectedValue, actualValue); } }
/** * This method iterates through a set of expected values and makes various assertions that * will pass if our app is functioning properly. * * @param error Message when an error occurs * @param valueCursor The Cursor containing the actual values received from an arbitrary query * @param expectedValues The values we expect to receive in valueCursor */ static void validateCurrentRecord(String error, Cursor valueCursor, ContentValues expectedValues) { Set<Map.Entry<String, Object>> valueSet = expectedValues.valueSet(); for (Map.Entry<String, Object> entry : valueSet) { String columnName = entry.getKey(); int index = valueCursor.getColumnIndex(columnName); /* Test to see if the column is contained within the cursor */ String columnNotFoundError = "Column '" + columnName + "' not found. " + error; assertFalse(columnNotFoundError, index == -1); /* Test to see if the expected value equals the actual value (from the Cursor) */ String expectedValue = entry.getValue().toString(); String actualValue = valueCursor.getString(index); String valuesDontMatchError = "Actual value '" + actualValue + "' did not match the expected value '" + expectedValue + "'. " + error; assertEquals(valuesDontMatchError, expectedValue, actualValue); } }
/** * This method iterates through a set of expected values and makes various assertions that * will pass if our app is functioning properly. * * @param error Message when an error occurs * @param valueCursor The Cursor containing the actual values received from an arbitrary query * @param expectedValues The values we expect to receive in valueCursor */ static void validateCurrentRecord(String error, Cursor valueCursor, ContentValues expectedValues) { Set<Map.Entry<String, Object>> valueSet = expectedValues.valueSet(); for (Map.Entry<String, Object> entry : valueSet) { String columnName = entry.getKey(); int index = valueCursor.getColumnIndex(columnName); /* Test to see if the column is contained within the cursor */ String columnNotFoundError = "Column '" + columnName + "' not found. " + error; assertFalse(columnNotFoundError, index == -1); /* Test to see if the expected value equals the actual value (from the Cursor) */ String expectedValue = entry.getValue().toString(); String actualValue = valueCursor.getString(index); String valuesDontMatchError = "Actual value '" + actualValue + "' did not match the expected value '" + expectedValue + "'. " + error; assertEquals(valuesDontMatchError, expectedValue, actualValue); } }
/** * This method iterates through a set of expected values and makes various assertions that * will pass if our app is functioning properly. * * @param error Message when an error occurs * @param valueCursor The Cursor containing the actual values received from an arbitrary query * @param expectedValues The values we expect to receive in valueCursor */ static void validateCurrentRecord(String error, Cursor valueCursor, ContentValues expectedValues) { Set<Map.Entry<String, Object>> valueSet = expectedValues.valueSet(); for (Map.Entry<String, Object> entry : valueSet) { String columnName = entry.getKey(); int index = valueCursor.getColumnIndex(columnName); /* Test to see if the column is contained within the cursor */ String columnNotFoundError = "Column '" + columnName + "' not found. " + error; assertFalse(columnNotFoundError, index == -1); /* Test to see if the expected value equals the actual value (from the Cursor) */ String expectedValue = entry.getValue().toString(); String actualValue = valueCursor.getString(index); String valuesDontMatchError = "Actual value '" + actualValue + "' did not match the expected value '" + expectedValue + "'. " + error; assertEquals(valuesDontMatchError, expectedValue, actualValue); } }
/** * This method iterates through a set of expected values and makes various assertions that * will pass if our app is functioning properly. * * @param error Message when an error occurs * @param valueCursor The Cursor containing the actual values received from an arbitrary query * @param expectedValues The values we expect to receive in valueCursor */ static void validateCurrentRecord(String error, Cursor valueCursor, ContentValues expectedValues) { Set<Map.Entry<String, Object>> valueSet = expectedValues.valueSet(); for (Map.Entry<String, Object> entry : valueSet) { String columnName = entry.getKey(); int index = valueCursor.getColumnIndex(columnName); /* Test to see if the column is contained within the cursor */ String columnNotFoundError = "Column '" + columnName + "' not found. " + error; assertFalse(columnNotFoundError, index == -1); /* Test to see if the expected value equals the actual value (from the Cursor) */ String expectedValue = entry.getValue().toString(); String actualValue = valueCursor.getString(index); String valuesDontMatchError = "Actual value '" + actualValue + "' did not match the expected value '" + expectedValue + "'. " + error; assertEquals(valuesDontMatchError, expectedValue, actualValue); } }
/** * This method iterates through a set of expected values and makes various assertions that * will pass if our app is functioning properly. * * @param error Message when an error occurs * @param valueCursor The Cursor containing the actual values received from an arbitrary query * @param expectedValues The values we expect to receive in valueCursor */ static void validateCurrentRecord(String error, Cursor valueCursor, ContentValues expectedValues) { Set<Map.Entry<String, Object>> valueSet = expectedValues.valueSet(); for (Map.Entry<String, Object> entry : valueSet) { String columnName = entry.getKey(); int index = valueCursor.getColumnIndex(columnName); /* Test to see if the column is contained within the cursor */ String columnNotFoundError = "Column '" + columnName + "' not found. " + error; assertFalse(columnNotFoundError, index == -1); /* Test to see if the expected value equals the actual value (from the Cursor) */ String expectedValue = entry.getValue().toString(); String actualValue = valueCursor.getString(index); String valuesDontMatchError = "Actual value '" + actualValue + "' did not match the expected value '" + expectedValue + "'. " + error; assertEquals(valuesDontMatchError, expectedValue, actualValue); } }
/** * This method iterates through a set of expected values and makes various assertions that * will pass if our app is functioning properly. * * @param error Message when an error occurs * @param valueCursor The Cursor containing the actual values received from an arbitrary query * @param expectedValues The values we expect to receive in valueCursor */ static void validateCurrentRecord(String error, Cursor valueCursor, ContentValues expectedValues) { Set<Map.Entry<String, Object>> valueSet = expectedValues.valueSet(); for (Map.Entry<String, Object> entry : valueSet) { String columnName = entry.getKey(); int index = valueCursor.getColumnIndex(columnName); /* Test to see if the column is contained within the cursor */ String columnNotFoundError = "Column '" + columnName + "' not found. " + error; assertFalse(columnNotFoundError, index == -1); /* Test to see if the expected value equals the actual value (from the Cursor) */ String expectedValue = entry.getValue().toString(); String actualValue = valueCursor.getString(index); String valuesDontMatchError = "Actual value '" + actualValue + "' did not match the expected value '" + expectedValue + "'. " + error; assertEquals(valuesDontMatchError, expectedValue, actualValue); } }
/** * This method iterates through a set of expected values and makes various assertions that * will pass if our app is functioning properly. * * @param error Message when an error occurs * @param valueCursor The Cursor containing the actual values received from an arbitrary query * @param expectedValues The values we expect to receive in valueCursor */ static void validateCurrentRecord(String error, Cursor valueCursor, ContentValues expectedValues) { Set<Map.Entry<String, Object>> valueSet = expectedValues.valueSet(); for (Map.Entry<String, Object> entry : valueSet) { String columnName = entry.getKey(); int index = valueCursor.getColumnIndex(columnName); /* Test to see if the column is contained within the cursor */ String columnNotFoundError = "Column '" + columnName + "' not found. " + error; assertFalse(columnNotFoundError, index == -1); /* Test to see if the expected value equals the actual value (from the Cursor) */ String expectedValue = entry.getValue().toString(); String actualValue = valueCursor.getString(index); String valuesDontMatchError = "Actual value '" + actualValue + "' did not match the expected value '" + expectedValue + "'. " + error; assertEquals(valuesDontMatchError, expectedValue, actualValue); } }
/** * This method iterates through a set of expected values and makes various assertions that * will pass if our app is functioning properly. * * @param error Message when an error occurs * @param valueCursor The Cursor containing the actual values received from an arbitrary query * @param expectedValues The values we expect to receive in valueCursor */ static void validateCurrentRecord(String error, Cursor valueCursor, ContentValues expectedValues) { Set<Map.Entry<String, Object>> valueSet = expectedValues.valueSet(); for (Map.Entry<String, Object> entry : valueSet) { String columnName = entry.getKey(); int index = valueCursor.getColumnIndex(columnName); /* Test to see if the column is contained within the cursor */ String columnNotFoundError = "Column '" + columnName + "' not found. " + error; assertFalse(columnNotFoundError, index == -1); /* Test to see if the expected value equals the actual value (from the Cursor) */ String expectedValue = entry.getValue().toString(); String actualValue = valueCursor.getString(index); String valuesDontMatchError = "Actual value '" + actualValue + "' did not match the expected value '" + expectedValue + "'. " + error; assertEquals(valuesDontMatchError, expectedValue, actualValue); } }
/** * This method iterates through a set of expected values and makes various assertions that * will pass if our app is functioning properly. * * @param error Message when an error occurs * @param valueCursor The Cursor containing the actual values received from an arbitrary query * @param expectedValues The values we expect to receive in valueCursor */ static void validateCurrentRecord(String error, Cursor valueCursor, ContentValues expectedValues) { Set<Map.Entry<String, Object>> valueSet = expectedValues.valueSet(); for (Map.Entry<String, Object> entry : valueSet) { String columnName = entry.getKey(); int index = valueCursor.getColumnIndex(columnName); /* Test to see if the column is contained within the cursor */ String columnNotFoundError = "Column '" + columnName + "' not found. " + error; assertFalse(columnNotFoundError, index == -1); /* Test to see if the expected value equals the actual value (from the Cursor) */ String expectedValue = entry.getValue().toString(); String actualValue = valueCursor.getString(index); String valuesDontMatchError = "Actual value '" + actualValue + "' did not match the expected value '" + expectedValue + "'. " + error; assertEquals(valuesDontMatchError, expectedValue, actualValue); } }
/** * This method iterates through a set of expected values and makes various assertions that * will pass if our app is functioning properly. * * @param error Message when an error occurs * @param valueCursor The Cursor containing the actual values received from an arbitrary query * @param expectedValues The values we expect to receive in valueCursor */ static void validateCurrentRecord(String error, Cursor valueCursor, ContentValues expectedValues) { Set<Map.Entry<String, Object>> valueSet = expectedValues.valueSet(); for (Map.Entry<String, Object> entry : valueSet) { String columnName = entry.getKey(); int index = valueCursor.getColumnIndex(columnName); /* Test to see if the column is contained within the cursor */ String columnNotFoundError = "Column '" + columnName + "' not found. " + error; assertFalse(columnNotFoundError, index == -1); /* Test to see if the expected value equals the actual value (from the Cursor) */ String expectedValue = entry.getValue().toString(); String actualValue = valueCursor.getString(index); String valuesDontMatchError = "Actual value '" + actualValue + "' did not match the expected value '" + expectedValue + "'. " + error; assertEquals(valuesDontMatchError, expectedValue, actualValue); } }
/** * This method iterates through a set of expected values and makes various assertions that * will pass if our app is functioning properly. * * @param error Message when an error occurs * @param valueCursor The Cursor containing the actual values received from an arbitrary query * @param expectedValues The values we expect to receive in valueCursor */ static void validateCurrentRecord(String error, Cursor valueCursor, ContentValues expectedValues) { Set<Map.Entry<String, Object>> valueSet = expectedValues.valueSet(); for (Map.Entry<String, Object> entry : valueSet) { String columnName = entry.getKey(); int index = valueCursor.getColumnIndex(columnName); /* Test to see if the column is contained within the cursor */ String columnNotFoundError = "Column '" + columnName + "' not found. " + error; assertFalse(columnNotFoundError, index == -1); /* Test to see if the expected value equals the actual value (from the Cursor) */ String expectedValue = entry.getValue().toString(); String actualValue = valueCursor.getString(index); String valuesDontMatchError = "Actual value '" + actualValue + "' did not match the expected value '" + expectedValue + "'. " + error; assertEquals(valuesDontMatchError, expectedValue, actualValue); } }
/** * This method iterates through a set of expected values and makes various assertions that * will pass if our app is functioning properly. * * @param error Message when an error occurs * @param valueCursor The Cursor containing the actual values received from an arbitrary query * @param expectedValues The values we expect to receive in valueCursor */ static void validateCurrentRecord(String error, Cursor valueCursor, ContentValues expectedValues) { Set<Map.Entry<String, Object>> valueSet = expectedValues.valueSet(); for (Map.Entry<String, Object> entry : valueSet) { String columnName = entry.getKey(); int index = valueCursor.getColumnIndex(columnName); /* Test to see if the column is contained within the cursor */ String columnNotFoundError = "Column '" + columnName + "' not found. " + error; assertFalse(columnNotFoundError, index == -1); /* Test to see if the expected value equals the actual value (from the Cursor) */ String expectedValue = entry.getValue().toString(); String actualValue = valueCursor.getString(index); String valuesDontMatchError = "Actual value '" + actualValue + "' did not match the expected value '" + expectedValue + "'. " + error; assertEquals(valuesDontMatchError, expectedValue, actualValue); } }
/** * This method iterates through a set of expected values and makes various assertions that * will pass if our app is functioning properly. * * @param error Message when an error occurs * @param valueCursor The Cursor containing the actual values received from an arbitrary query * @param expectedValues The values we expect to receive in valueCursor */ static void validateCurrentRecord(String error, Cursor valueCursor, ContentValues expectedValues) { Set<Map.Entry<String, Object>> valueSet = expectedValues.valueSet(); for (Map.Entry<String, Object> entry : valueSet) { String columnName = entry.getKey(); int index = valueCursor.getColumnIndex(columnName); /* Test to see if the column is contained within the cursor */ String columnNotFoundError = "Column '" + columnName + "' not found. " + error; assertFalse(columnNotFoundError, index == -1); /* Test to see if the expected value equals the actual value (from the Cursor) */ String expectedValue = entry.getValue().toString(); String actualValue = valueCursor.getString(index); String valuesDontMatchError = "Actual value '" + actualValue + "' did not match the expected value '" + expectedValue + "'. " + error; assertEquals(valuesDontMatchError, expectedValue, actualValue); } }
/** * This method iterates through a set of expected values and makes various assertions that * will pass if our app is functioning properly. * * @param error Message when an error occurs * @param valueCursor The Cursor containing the actual values received from an arbitrary query * @param expectedValues The values we expect to receive in valueCursor */ static void validateCurrentRecord(String error, Cursor valueCursor, ContentValues expectedValues) { Set<Map.Entry<String, Object>> valueSet = expectedValues.valueSet(); for (Map.Entry<String, Object> entry : valueSet) { String columnName = entry.getKey(); int index = valueCursor.getColumnIndex(columnName); /* Test to see if the column is contained within the cursor */ String columnNotFoundError = "Column '" + columnName + "' not found. " + error; assertFalse(columnNotFoundError, index == -1); /* Test to see if the expected value equals the actual value (from the Cursor) */ String expectedValue = entry.getValue().toString(); String actualValue = valueCursor.getString(index); String valuesDontMatchError = "Actual value '" + actualValue + "' did not match the expected value '" + expectedValue + "'. " + error; assertEquals(valuesDontMatchError, expectedValue, actualValue); } }
/** * This method iterates through a set of expected values and makes various assertions that * will pass if our app is functioning properly. * * @param error Message when an error occurs * @param valueCursor The Cursor containing the actual values received from an arbitrary query * @param expectedValues The values we expect to receive in valueCursor */ static void validateCurrentRecord(String error, Cursor valueCursor, ContentValues expectedValues) { Set<Map.Entry<String, Object>> valueSet = expectedValues.valueSet(); for (Map.Entry<String, Object> entry : valueSet) { String columnName = entry.getKey(); int index = valueCursor.getColumnIndex(columnName); /* Test to see if the column is contained within the cursor */ String columnNotFoundError = "Column '" + columnName + "' not found. " + error; assertFalse(columnNotFoundError, index == -1); /* Test to see if the expected value equals the actual value (from the Cursor) */ String expectedValue = entry.getValue().toString(); String actualValue = valueCursor.getString(index); String valuesDontMatchError = "Actual value '" + actualValue + "' did not match the expected value '" + expectedValue + "'. " + error; assertEquals(valuesDontMatchError, expectedValue, actualValue); } }