DimensionDictionary implements Serializable { public String getDimensionValue(String dimensionName, Integer valueId) { String dimensionValue = getReverseDictionary(dimensionName).get(valueId); if (dimensionValue == null) { throw new IllegalArgumentException("No dimension value for " + dimensionName + ":" + valueId); } return dimensionValue; } DimensionDictionary();  DimensionDictionary(Map<String, Map<String, Integer>> dictionary); void setDictionary(Map<String, Map<String, Integer>> dictionary); Map<String, Map<String, Integer>> getDictionary(); Map<String, Map<Integer, String>> getReverseDictionary(); Map<String, Integer> getDictionary(String dimensionName); Map<Integer, String> getReverseDictionary(String dimensionName); Integer getValueId(String dimensionName, String dimensionValue); String getDimensionValue(String dimensionName, Integer valueId); int[] translate(List<DimensionSpec> dimensions, DimensionKey dimensionKey); DimensionKey translate(List<DimensionSpec> dimensions, int[] dimensionKey); @Override boolean equals(Object o);  }
@Test public void testGetDimensionValue() { Assert.assertEquals(dictionary.getDimensionValue("A", 2), "A0"); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testGetDimensionValueNoMapping() { dictionary.getDimensionValue("A", 100); }