@SuppressWarnings("unchecked")
  public static <K, V> V getWithDefault(final Map<K, ? extends Object> map,
                                        final K key,
                                        final V defaultValue,
                                        final Class<V> valueClass)
  {
    final Object actualValue = map.get(key);
    if (actualValue == null)
    {
      return defaultValue;
    }

    if (valueClass.isAssignableFrom(actualValue.getClass()))
    {
      return (V) actualValue;
    }

    if (!(actualValue instanceof String))
    {
      throw new IllegalArgumentException("Unsupported actual value type: "
          + actualValue.getClass());
    }

    final String valStr = (String) actualValue;
    if (valueClass.equals(Double.class))
    {
      return (V) Double.valueOf(Double.parseDouble(valStr));
    }
    if (valueClass.equals(Float.class))
    {
      return (V) Float.valueOf(Float.parseFloat(valStr));
    }
    if (valueClass.equals(Long.class))
    {
      return (V) Long.valueOf(Long.parseLong(valStr));
    }
    if (valueClass.equals(Integer.class))
    {
      return (V) Integer.valueOf(Integer.parseInt(valStr));
    }
    if (valueClass.equals(Boolean.class))
    {
      return (V) Boolean.valueOf(Boolean.parseBoolean(valStr));
    }

    throw new IllegalArgumentException("Unsupported expected value type: " + valueClass + " and value = " +
                                           actualValue);
  }
@Test(expectedExceptions = IllegalArgumentException.class)
  public void testSiblingCastException()
  {
    MapUtil.getWithDefault(_subjectMap, "siblingMap", _probeMap);
  }