### Question:
TwoDimTaskGenerator extends Generator { @Override public long decode(String column, String globalID) { Long hashNum; try { hashNum = Long.parseLong( globalID.substring(globalID.length() - HASH_LENGTH, globalID.length()), 16); } catch (Exception ignore) { LOG.error("Parse globalID failed", ignore); return -1; } long result = -1; if (column.equals(firstDim)) result = hashNum >> 10; if (column.equals(secondDim)) result = hashNum - (hashNum >> 10 << 10); return result; } TwoDimTaskGenerator(String prefix, String firstDim, String secondDim); @Override void getGlobalID(SeqsHandler handler); @Override String calc(long globalID, Map<String, String> params); @Override long decode(String column, String globalID);  }### Answer:
@Test public void testDecode() throws Exception { String buyerId = "123"; String sellerId = "456"; String contractTaskId = "26383326abc8c9d5"; assertEquals(contractTaskGenerator.decode(GeneratorUtil.FIRST_DIM, contractTaskId), Generator.getHashCode(buyerId)); assertEquals(contractTaskGenerator.decode(GeneratorUtil.SECOND_DIM, contractTaskId), Generator.getHashCode(sellerId)); }
@Test public void testDecodeIllegalTaskId() throws Exception { String illegal = "26383326abc8c9dz"; assertEquals(contractTaskGenerator.decode(GeneratorUtil.FIRST_DIM, illegal), -1); assertEquals(contractTaskGenerator.decode(GeneratorUtil.SECOND_DIM, illegal), -1); }