### Question:
HealthDataNotificationFilter { public List<HealthDataValue> filter(final HealthData healthData) { final List<HealthDataValue> filtered = new ArrayList<HealthDataValue>(); final List<HealthDataValue> values = healthData.getValues(); for (final HealthDataValue value : values) { final HealthDataField field = value.getField(); if (field.getNotification()) { checkUpperLimit(filtered, field, value); checkLowerLimit(filtered, field, value); } } return filtered; }  List<HealthDataValue> filter(final HealthData healthData);  }### Answer:
@Test public void getEmptyWithAllNecessaryField() throws Exception { field1.setNotification(false); field2.setNotification(false); final HealthDataValue value1 = createDataValue(field1, upperLimit1 + 10); final HealthDataValue value2 = createDataValue(field2, upperLimit2 - 10); final HealthData healthData = createHealthData(value1, value2); final List<HealthDataValue> result = notificationFilter.filter(healthData); Assert.assertEquals(0, result.size()); }
@Test public void getEmptyWithRegularValues() throws Exception { final HealthDataValue value1 = createDataValue(field1, upperLimit1 - 10); final HealthDataValue value2 = createDataValue(field2, upperLimit2 - 10); final HealthData healthData = createHealthData(value1, value2); final List<HealthDataValue> result = notificationFilter.filter(healthData); Assert.assertEquals(0, result.size()); }
@Test public void getOneWithOneUpperThanLimit() throws Exception { final HealthDataValue value1 = createDataValue(field1, upperLimit1 + 10); final HealthDataValue value2 = createDataValue(field2, upperLimit2 - 10); final HealthData healthData = createHealthData(value1, value2); final List<HealthDataValue> result = notificationFilter.filter(healthData); Assert.assertEquals(1, result.size()); }
@Test public void getTwoWithTwoLowerThanLimit() throws Exception { final HealthDataValue value1 = createDataValue(field1, lowerLimit1 - 1); final HealthDataValue value2 = createDataValue(field2, lowerLimit2 - 1); final HealthData healthData = createHealthData(value1, value2); final List<HealthDataValue> result = notificationFilter.filter(healthData); Assert.assertEquals(2, result.size()); }
@Test public void getTwoOneUpperThanLimitOneLowerThanLimit() throws Exception { final HealthDataValue value1 = createDataValue(field1, upperLimit1 + 10); final HealthDataValue value2 = createDataValue(field2, lowerLimit2 - 1); final HealthData healthData = createHealthData(value1, value2); final List<HealthDataValue> result = notificationFilter.filter(healthData); Assert.assertEquals(2, result.size()); }