Index: profile/src/main/java/geniusweb/profile/utilityspace/NumberValueSetUtilities.java
===================================================================
--- profile/src/main/java/geniusweb/profile/utilityspace/NumberValueSetUtilities.java	(revision 2)
+++ profile/src/main/java/geniusweb/profile/utilityspace/NumberValueSetUtilities.java	(revision 3)
@@ -6,4 +6,7 @@
 import com.fasterxml.jackson.annotation.JsonAutoDetect;
 import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonTypeName;
 
 import geniusweb.issuevalue.NumberValue;
@@ -11,9 +14,4 @@
 import geniusweb.issuevalue.Value;
 import geniusweb.issuevalue.ValueSet;
-
-import com.fasterxml.jackson.annotation.JsonCreator;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonTypeName;
-
 import tudelft.utilities.immutablelist.Range;
 
@@ -100,6 +98,6 @@
 		}
 		if (numvalset.getRange().getHigh().compareTo(highValue) != 0) {
-			return "the utilities are specified down to " + highValue
-					+ " but the valueset starts at "
+			return "the utilities are specified up to " + highValue
+					+ " but the valueset ends at "
 					+ numvalset.getRange().getHigh();
 		}
Index: profile/src/test/java/geniusweb/profile/utilityspace/DiscreteValueSetUtilitiesTest.java
===================================================================
--- profile/src/test/java/geniusweb/profile/utilityspace/DiscreteValueSetUtilitiesTest.java	(revision 2)
+++ profile/src/test/java/geniusweb/profile/utilityspace/DiscreteValueSetUtilitiesTest.java	(revision 3)
@@ -1,3 +1,5 @@
 package geniusweb.profile.utilityspace;
+
+import static org.junit.Assert.assertEquals;
 
 import java.math.BigDecimal;
@@ -10,12 +12,17 @@
 
 import geniusweb.issuevalue.DiscreteValue;
-import geniusweb.profile.utilityspace.DiscreteValueSetUtilities;
+import geniusweb.issuevalue.DiscreteValueSet;
+import geniusweb.issuevalue.NumberValue;
+import geniusweb.issuevalue.NumberValueSet;
+import geniusweb.issuevalue.ValueSet;
 import tudelft.utilities.junit.GeneralTests;
 
-public class DiscreteValueSetUtilitiesTest extends GeneralTests<DiscreteValueSetUtilities> {
+public class DiscreteValueSetUtilitiesTest
+		extends GeneralTests<DiscreteValueSetUtilities> {
 
 	private final static DiscreteValue vala = new DiscreteValue("a");
 	private final static DiscreteValue vala1 = new DiscreteValue("a");
 	private final static DiscreteValue valb = new DiscreteValue("b");
+	private final static NumberValue valn = new NumberValue("99");
 
 	private final static BigDecimal util = new BigDecimal("0.14");
@@ -23,5 +30,9 @@
 	private final static BigDecimal utilb = new BigDecimal("0.37");
 
-	private final static DiscreteValueSetUtilities utils, utils1, utilsb, utils1b, utilsc1, utilsc2;
+	private final static BigDecimal badutil = new BigDecimal("1.37");
+	private final static BigDecimal badutil2 = new BigDecimal("-0.37");
+
+	private final static DiscreteValueSetUtilities utils, utils1, utilsb,
+			utils1b, utilsc1, utilsc2;
 
 	static {
@@ -56,5 +67,6 @@
 	@Override
 	public List<List<DiscreteValueSetUtilities>> getGeneralTestData() {
-		return Arrays.asList(Arrays.asList(utils, utils1), Arrays.asList(utilsb), Arrays.asList(utils1b),
+		return Arrays.asList(Arrays.asList(utils, utils1),
+				Arrays.asList(utilsb), Arrays.asList(utils1b),
 				Arrays.asList(utilsc1, utilsc2));
 	}
@@ -62,6 +74,8 @@
 	@Override
 	public List<String> getGeneralTestStrings() {
-		return Arrays.asList("ValueSetUtilities\\{\"a\"=0.14\\}", "ValueSetUtilities\\{\"b\"=0.37\\}",
-				"ValueSetUtilities\\{\"a\"=0.37\\}", "ValueSetUtilities\\{\"a\"=0.14, \"b\"=0.37\\}");
+		return Arrays.asList("ValueSetUtilities\\{\"a\"=0.14\\}",
+				"ValueSetUtilities\\{\"b\"=0.37\\}",
+				"ValueSetUtilities\\{\"a\"=0.37\\}",
+				"ValueSetUtilities\\{\"a\"=0.14, \"b\"=0.37\\}");
 	}
 
@@ -72,3 +86,96 @@
 	}
 
+	@Test(expected = IllegalArgumentException.class)
+	public void testTooLargeUtility() {
+		Map<DiscreteValue, BigDecimal> valueUtils = new HashMap<>();
+		valueUtils.put(vala, util);
+		valueUtils.put(valb, badutil);
+		new DiscreteValueSetUtilities(valueUtils);
+	}
+
+	@Test(expected = IllegalArgumentException.class)
+	public void testNegativeUtility() {
+		Map<DiscreteValue, BigDecimal> valueUtils = new HashMap<>();
+		valueUtils.put(vala, util);
+		valueUtils.put(valb, badutil2);
+		new DiscreteValueSetUtilities(valueUtils);
+	}
+
+	@Test(expected = IllegalArgumentException.class)
+	public void testNullUtility() {
+		Map<DiscreteValue, BigDecimal> valueUtils = new HashMap<>();
+		valueUtils.put(vala, null);
+		valueUtils.put(valb, util);
+		new DiscreteValueSetUtilities(valueUtils);
+	}
+
+	@Test(expected = NullPointerException.class)
+	public void testNullValueUtils() {
+		new DiscreteValueSetUtilities(null);
+
+	}
+
+	@Test(expected = NullPointerException.class)
+	public void testNullIssue() {
+		Map<DiscreteValue, BigDecimal> valueUtils = new HashMap<>();
+		valueUtils.put(vala, util);
+		valueUtils.put(null, utilb);
+		new DiscreteValueSetUtilities(valueUtils);
+	}
+
+	@Test
+	public void testGetUtility() {
+		Map<DiscreteValue, BigDecimal> valueUtils = new HashMap<>();
+		valueUtils.put(vala, util);
+		valueUtils.put(valb, utilb);
+		DiscreteValueSetUtilities utilset = new DiscreteValueSetUtilities(
+				valueUtils);
+		assertEquals(util, utilset.getUtility(vala));
+		assertEquals(utilb, utilset.getUtility(valb));
+		assertEquals(BigDecimal.ZERO,
+				utilset.getUtility(new DiscreteValue("unknownIssue")));
+
+	}
+
+	@Test
+	public void testIsFitting() {
+		ValueSet valueset = new DiscreteValueSet(Arrays.asList(vala, valb));
+
+		Map<DiscreteValue, BigDecimal> valueUtils = new HashMap<>();
+		valueUtils.put(vala, util);
+		DiscreteValueSetUtilities utilset = new DiscreteValueSetUtilities(
+				valueUtils);
+
+		assertEquals(
+				"The values in the set DiscreteValueSet[\"a\", \"b\"] do not match the values mapped to utilities [\"a\"]",
+				utilset.isFitting(valueset));
+
+		valueUtils.put(valb, utilb);
+		utilset = new DiscreteValueSetUtilities(valueUtils);
+		assertEquals(null, utilset.isFitting(valueset));
+
+		valueUtils.put(new DiscreteValue("unknownIssue"), util1);
+		utilset = new DiscreteValueSetUtilities(valueUtils);
+		assertEquals(
+				"The values in the set DiscreteValueSet[\"a\", \"b\"] do not match the values mapped to utilities [\"a\", \"b\", \"unknownIssue\"]",
+				utilset.isFitting(valueset));
+
+	}
+
+	@Test
+	public void testIsFittingWrongType() {
+		ValueSet valueset = new NumberValueSet(BigDecimal.ZERO, BigDecimal.ONE,
+				new BigDecimal("0.3"));
+
+		Map<DiscreteValue, BigDecimal> valueUtils = new HashMap<>();
+		valueUtils.put(vala, util);
+		valueUtils.put(valb, utilb);
+		DiscreteValueSetUtilities utilset = new DiscreteValueSetUtilities(
+				valueUtils);
+
+		assertEquals(
+				"The utilities are for a discrete valueset but the given values are numberValueSet[0,1,0.3]",
+				utilset.isFitting(valueset));
+
+	}
 }
Index: profile/src/test/java/geniusweb/profile/utilityspace/NumberValueSetUtilTest.java
===================================================================
--- profile/src/test/java/geniusweb/profile/utilityspace/NumberValueSetUtilTest.java	(revision 2)
+++ profile/src/test/java/geniusweb/profile/utilityspace/NumberValueSetUtilTest.java	(revision 3)
@@ -9,9 +9,14 @@
 import org.junit.Test;
 
+import geniusweb.issuevalue.DiscreteValue;
+import geniusweb.issuevalue.DiscreteValueSet;
 import geniusweb.issuevalue.NumberValue;
-import geniusweb.profile.utilityspace.NumberValueSetUtilities;
+import geniusweb.issuevalue.NumberValueSet;
+import geniusweb.issuevalue.ValueSet;
+import tudelft.utilities.immutablelist.Range;
 import tudelft.utilities.junit.GeneralTests;
 
-public class NumberValueSetUtilTest extends GeneralTests<NumberValueSetUtilities> {
+public class NumberValueSetUtilTest
+		extends GeneralTests<NumberValueSetUtilities> {
 
 	private static final BigDecimal lowval1 = new BigDecimal("12.5");
@@ -21,21 +26,24 @@
 	private static final BigDecimal highvalb = new BigDecimal("18.4");
 	private static final BigDecimal highutil = new BigDecimal("0.9");
-	private static final NumberValueSetUtilities valueset1 = new NumberValueSetUtilities(lowval1, low1util, highval,
-			highutil);
-	private static final NumberValueSetUtilities valueset1b = new NumberValueSetUtilities(lowval1, low1util, highval,
-			highutil);
-	private static final NumberValueSetUtilities valueset2 = new NumberValueSetUtilities(lowval1, low1utilb, highval,
-			highutil);
-	private static final NumberValueSetUtilities valueset3 = new NumberValueSetUtilities(lowval1, low1util, highvalb,
-			highutil);
+	private static final NumberValueSetUtilities valueset1 = new NumberValueSetUtilities(
+			lowval1, low1util, highval, highutil);
+	private static final NumberValueSetUtilities valueset1b = new NumberValueSetUtilities(
+			lowval1, low1util, highval, highutil);
+	private static final NumberValueSetUtilities valueset2 = new NumberValueSetUtilities(
+			lowval1, low1utilb, highval, highutil);
+	private static final NumberValueSetUtilities valueset3 = new NumberValueSetUtilities(
+			lowval1, low1util, highvalb, highutil);
+	private static final BigDecimal ZERO_1 = new BigDecimal("0.1");
 
 	@Override
 	public List<List<NumberValueSetUtilities>> getGeneralTestData() {
-		return Arrays.asList(Arrays.asList(valueset1, valueset1b), Arrays.asList(valueset2), Arrays.asList(valueset3));
+		return Arrays.asList(Arrays.asList(valueset1, valueset1b),
+				Arrays.asList(valueset2), Arrays.asList(valueset3));
 	}
 
 	@Override
 	public List<String> getGeneralTestStrings() {
-		return Arrays.asList("NumberValUtility\\(12.5->0.5,18.5->0.9\\)", "NumberValUtility\\(12.5->0.6,18.5->0.9\\)",
+		return Arrays.asList("NumberValUtility\\(12.5->0.5,18.5->0.9\\)",
+				"NumberValUtility\\(12.5->0.6,18.5->0.9\\)",
 				"NumberValUtility\\(12.5->0.5,18.4->0.9\\)");
 	}
@@ -49,16 +57,118 @@
 	public void utilAscentingTest() {
 		NumberValueSetUtilities utils = valueset1;
-		assertEquals(0, low1util.compareTo(utils.getUtility(new NumberValue(lowval1))));
+		assertEquals(0,
+				low1util.compareTo(utils.getUtility(new NumberValue(lowval1))));
 	}
 
 	@Test
 	public void utilDescendingTest() {
-		NumberValueSetUtilities utils = new NumberValueSetUtilities(lowval1, highutil, highval, low1util);
-		assertEquals(0, highutil.compareTo(utils.getUtility(new NumberValue(lowval1))));
+		NumberValueSetUtilities utils = new NumberValueSetUtilities(lowval1,
+				highutil, highval, low1util);
+		assertEquals(0,
+				highutil.compareTo(utils.getUtility(new NumberValue(lowval1))));
 	}
 
 	@Test(expected = IllegalArgumentException.class)
 	public void reverserangetest() {
-		NumberValueSetUtilities utils = new NumberValueSetUtilities(highval, highutil, lowval1, low1util);
+		NumberValueSetUtilities utils = new NumberValueSetUtilities(highval,
+				low1util, highval, highutil);
+	}
+
+	@Test(expected = NullPointerException.class)
+	public void testNullHigh() {
+		NumberValueSetUtilities utils = new NumberValueSetUtilities(lowval1,
+				low1util, null, highutil);
+	}
+
+	@Test(expected = NullPointerException.class)
+	public void testNullHighUtil() {
+		NumberValueSetUtilities utils = new NumberValueSetUtilities(lowval1,
+				low1util, highval, null);
+	}
+
+	@Test(expected = NullPointerException.class)
+	public void testNullLow() {
+		NumberValueSetUtilities utils = new NumberValueSetUtilities(null,
+				low1util, highval, highutil);
+	}
+
+	@Test(expected = NullPointerException.class)
+	public void testNullLowUtil() {
+		NumberValueSetUtilities utils = new NumberValueSetUtilities(lowval1,
+				null, highval, highutil);
+	}
+
+	@Test(expected = IllegalArgumentException.class)
+	public void testLowUtilNegative() {
+		NumberValueSetUtilities utils = new NumberValueSetUtilities(lowval1,
+				new BigDecimal("-0.2"), highval, highutil);
+	}
+
+	@Test(expected = IllegalArgumentException.class)
+	public void testHighUtilNegative() {
+		NumberValueSetUtilities utils = new NumberValueSetUtilities(lowval1,
+				low1util, highval, new BigDecimal("-0.000003"));
+	}
+
+	@Test
+	public void getUtilTest() {
+		NumberValueSetUtilities utils = new NumberValueSetUtilities(lowval1,
+				low1util, highval, highutil);
+		assertEquals(0,
+				highutil.compareTo(utils.getUtility(new NumberValue(highval))));
+		assertEquals(0,
+				low1util.compareTo(utils.getUtility(new NumberValue(lowval1))));
+		// linear interpolated , check center
+		BigDecimal middleutil = low1util.add(highutil)
+				.divide(new BigDecimal("2"));
+		NumberValue middleval = new NumberValue(
+				lowval1.add(highval).divide(new BigDecimal("2")));
+		assertEquals(0, middleutil.compareTo(utils.getUtility(middleval)));
+
+	}
+
+	@Test
+	public void testIsNotFittingRange() {
+		ValueSet valueset = new NumberValueSet(
+				new Range(low1util, highutil, new BigDecimal("0.02")));
+		ValueSetUtilities utilset = new NumberValueSetUtilities(lowval1,
+				low1util, highval, highutil);
+		assertEquals(
+				"the utilities are specified down to 12.5 but the valueset starts at 0.5",
+				utilset.isFitting(valueset));
+	}
+
+	@Test
+	public void testTopOfRangeTooLarge() {
+		ValueSet valueset = new NumberValueSet(
+				new Range(lowval1, highval.subtract(ZERO_1), ZERO_1));
+		ValueSetUtilities utilset = new NumberValueSetUtilities(lowval1,
+				low1util, highval, highutil);
+		assertEquals(
+				"the utilities are specified up to 18.5 but the valueset ends at 18.4",
+				utilset.isFitting(valueset));
+	}
+
+	@Test
+	public void testIsFitting() {
+		ValueSet valueset = new NumberValueSet(
+				new Range(lowval1, highval, BigDecimal.ONE));
+		ValueSetUtilities utilset = new NumberValueSetUtilities(lowval1,
+				low1util, highval, highutil);
+		assertEquals(null, utilset.isFitting(valueset));
+	}
+
+	@Test
+	public void testIsFittingWrongType() {
+		DiscreteValue vala = new DiscreteValue("a");
+		DiscreteValue valb = new DiscreteValue("b");
+		ValueSet valueset = new DiscreteValueSet(Arrays.asList(vala, valb));
+
+		NumberValueSetUtilities utilset = new NumberValueSetUtilities(lowval1,
+				low1util, highval, highutil);
+		assertEquals(
+				"The utilities are for a number valueset but the given values are DiscreteValueSet[\"a\", \"b\"]",
+				utilset.isFitting(valueset));
+
 	}
 
