### Question:
ConfigurationTypeHelper { public static long getTimeInMillis(String str) { TimeUnit timeUnit; int unitsLen = 1; switch (str.charAt(str.length() - 1)) { case 'd': timeUnit = TimeUnit.DAYS; break; case 'h': timeUnit = TimeUnit.HOURS; break; case 'm': timeUnit = TimeUnit.MINUTES; break; case 's': timeUnit = TimeUnit.SECONDS; if (str.endsWith("ms")) { timeUnit = TimeUnit.MILLISECONDS; unitsLen = 2; } break; default: timeUnit = TimeUnit.SECONDS; unitsLen = 0; break; } return timeUnit.toMillis(Long.parseLong(str.substring(0, str.length() - unitsLen))); }  static long getFixedMemoryAsBytes(String str); static long getMemoryAsBytes(String str); static long getTimeInMillis(String str); static double getFraction(String str); static T getClassInstance(String context, String clazzName, Class<T> base,
      T defaultInstance); static T getClassInstance(String context, String clazzName, Class<T> base); static int getNumThreads(String threads);  }### Answer:
@Test public void testGetTimeInMillis() { assertEquals(42L * 24 * 60 * 60 * 1000, ConfigurationTypeHelper.getTimeInMillis("42d")); assertEquals(42L * 60 * 60 * 1000, ConfigurationTypeHelper.getTimeInMillis("42h")); assertEquals(42L * 60 * 1000, ConfigurationTypeHelper.getTimeInMillis("42m")); assertEquals(42L * 1000, ConfigurationTypeHelper.getTimeInMillis("42s")); assertEquals(42L * 1000, ConfigurationTypeHelper.getTimeInMillis("42")); assertEquals(42L, ConfigurationTypeHelper.getTimeInMillis("42ms")); }
@Test(expected = IllegalArgumentException.class) public void testGetTimeInMillisFailureCase1() { ConfigurationTypeHelper.getTimeInMillis("abc"); }
@Test(expected = IllegalArgumentException.class) public void testGetTimeInMillisFailureCase2() { ConfigurationTypeHelper.getTimeInMillis("ms"); }