ScaleCategory { public boolean fallsIntoCategory(int rawValue) { if(rawValue >= minValue && rawValue <= maxValue) { return true; } else { return false; } } ScaleCategory(String name, int minValue, int maxValue, String sensorStateValue, int sensorValue); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); boolean fallsIntoCategory(int rawValue); String getName(); int getMinValue(); int getMaxValue(); String getSensorStateValue(); int getSensorValue();  }
@Test public void testFallsIntoCategory() throws Exception { String name = "Test category name"; int min = 10; int max = 20; String sensorStateValue = "State1"; int sensorValue = 1; ScaleCategory category = new ScaleCategory(name, min, max, sensorStateValue, sensorValue); Assert.assertFalse(category.fallsIntoCategory(9)); Assert.assertTrue(category.fallsIntoCategory(10)); Assert.assertTrue(category.fallsIntoCategory(20)); Assert.assertFalse(category.fallsIntoCategory(21)); }