@Test
public void testParseSparseInstance() {

	String testInstanceLine = generateSparseInstanceString(TEST_ATTRIBUTES, TEST_INSTANCE);
	Object parsedInstance = ArffDatasetAdapter.parseInstance(true, TEST_ATTRIBUTES, CLASS_INDEX, testInstanceLine);
	assertTrue("The returned instance is not in the expected sparse instance format", parsedInstance instanceof Map);
	@SuppressWarnings("unchecked")
	Map<Integer, Object> parsedSparseInstance = (Map<Integer, Object>) parsedInstance;
	for (int i = 0; i < TEST_INSTANCE.length; i++) {
		assertEquals("Attribute value at position " + i + " " + parsedSparseInstance.get(i) + " is not equal to the expected value " + TEST_INSTANCE[i], TEST_INSTANCE[i], parsedSparseInstance.get(i));
	}
	assertTrue("Numeric attribute is not a Number object but of type " + parsedSparseInstance.get(0).getClass().getName(), parsedSparseInstance.get(0) instanceof Number);
	assertNotNull("No instance label for sparse instance " + parsedSparseInstance, parsedSparseInstance.get(CLASS_INDEX));
}