### Question:
ByteArrayValueMappers { public static ByteArrayValueMapper getMapper(String mapperType) { if ("int".equals(mapperType)) { return INT_MAPPER; } else if ("long".equals(mapperType)) { return LONG_MAPPER; } else if ("string".equals(mapperType)) { return STRING_MAPPER; } else if ("boolean".equals(mapperType)) { return BOOLEAN_MAPPER; } else if ("float".equals(mapperType)) { return FLOAT_MAPPER; } else if ("double".equals(mapperType)) { return DOUBLE_MAPPER; } else if ("short".equals(mapperType)) { return SHORT_MAPPER; } else if ("bigdecimal".equals(mapperType)) { return BIG_DECIMAL_MAPPER; } else { return instantiateCustomMapper(mapperType); } }  static ByteArrayValueMapper getMapper(String mapperType);  }### Answer:
@Test public void testGetValueMapper_Int() { ByteArrayValueMapper mapper = ByteArrayValueMappers.getMapper("int"); assertEquals(Lists.newArrayList(42), mapper.map(Bytes.toBytes(42))); }
@Test public void testMapValue_InvalidEncoding() { ByteArrayValueMapper mapper = ByteArrayValueMappers.getMapper("long"); assertEquals(Collections.emptyList(), mapper.map(Bytes.toBytes(42))); }
@Test public void testGetValueMapper_Long() { ByteArrayValueMapper mapper = ByteArrayValueMappers.getMapper("long"); assertEquals(Lists.newArrayList(Long.MAX_VALUE), mapper.map(Bytes.toBytes(Long.MAX_VALUE))); }
@Test public void testGetValueMapper_String() { ByteArrayValueMapper mapper = ByteArrayValueMappers.getMapper("string"); assertEquals(Lists.newArrayList("forty-two"), mapper.map(Bytes.toBytes("forty-two"))); }
@Test public void testGetValueMapper_Boolean() { ByteArrayValueMapper mapper = ByteArrayValueMappers.getMapper("boolean"); assertEquals(Lists.newArrayList(true), mapper.map(Bytes.toBytes(true))); }
@Test public void testGetValueMapper_Float() { ByteArrayValueMapper mapper = ByteArrayValueMappers.getMapper("float"); assertEquals(Lists.newArrayList(4.2f), mapper.map(Bytes.toBytes(4.2f))); }
@Test public void testGetValueMapper_Double() { ByteArrayValueMapper mapper = ByteArrayValueMappers.getMapper("double"); assertEquals(Lists.newArrayList(Math.PI), mapper.map(Bytes.toBytes(Math.PI))); }
@Test public void testGetValueMapper_Short() { ByteArrayValueMapper mapper = ByteArrayValueMappers.getMapper("short"); assertEquals(Lists.newArrayList((short)42), mapper.map(Bytes.toBytes((short)42))); }
@Test public void testGetValueMapper_BigDecimal() { ByteArrayValueMapper mapper = ByteArrayValueMappers.getMapper("bigdecimal"); assertEquals(Lists.newArrayList(new BigDecimal("1.234")), mapper.map(Bytes.toBytes(new BigDecimal("1.234")))); }
@Test public void testGetValueMapper_CustomMapperClass() { ByteArrayValueMapper mapper = ByteArrayValueMappers.getMapper(MockValueMapper.class.getName()); assertEquals(Lists.newArrayList("A", "B", "C"), mapper.map(Bytes.toBytes("dummy value"))); }
@Test(expected = IllegalArgumentException.class) public void testGetValueMapper_CustomMapperClass_NotMapperImplementation() { ByteArrayValueMappers.getMapper(String.class.getName()); }
@Test(expected = IllegalArgumentException.class) public void testGetValueMapper_InvalidName() { ByteArrayValueMappers.getMapper("not.a.classname.or.primitive.Name"); }