### Question:
ContextUtils { public static Number getNumber(Context ctx, String name, Number defaultValue) { return getVariable(ctx, name, defaultValue, Number.class); } private  ContextUtils(); static UUID getUUID(Context ctx, String name); static int getInt(Context ctx, String name, int defaultValue); static Number getNumber(Context ctx, String name, Number defaultValue); static String getString(Context ctx, String name); static String getString(Context ctx, String name, String defaultValue); static boolean getBoolean(Context ctx, String name, boolean defaultValue); static Map<K, V> getMap(Context ctx, String key); static Map<K, V> getMap(Context ctx, HasKey k, Map<K, V> defaultValue); @SuppressWarnings("unchecked") static Map<K, V> getMap(Context ctx, String name, Map<K, V> defaultValue); @SuppressWarnings("unchecked") static List<E> getList(Context ctx, String name, List<E> defaultValue); static int assertInt(Context ctx, String name); static Number assertNumber(Context ctx, String name); static String assertString(Context ctx, String name); static String assertString(String message, Context ctx, String name); @SuppressWarnings("unchecked") static Map<K, V> assertMap(Context ctx, String name); @SuppressWarnings("unchecked") static List<E> assertList(Context ctx, String name); @SuppressWarnings("unchecked") static T getVariable(Context ctx, String name, T defaultValue); static T getVariable(Context ctx, String name, T defaultValue, Class<T> type); static T assertVariable(Context ctx, String name, Class<T> type); static T assertVariable(String message, Context ctx, String name, Class<T> type); static ProjectInfo getProjectInfo(Context ctx); static RepositoryInfo getRepositoryInfo(Context ctx); static Path getWorkDir(Context ctx); static UUID getTxId(Context ctx); static String getSessionToken(Context ctx);  }### Answer:
@Test public void testGetNumber() { Context ctx = new Ctx(); ctx.setVariable("k", 123L); ctx.setVariable("not-number", "boom"); Number result = ContextUtils.getVariable(ctx, "k", null, Number.class); assertNotNull(result); assertEquals(123L, result); result = ContextUtils.getVariable(ctx, "not-found", null, Number.class); assertNull(result); result = ContextUtils.getVariable(ctx, "not-found", -1, Number.class); assertNotNull(result); assertEquals(-1, result); result = ContextUtils.getNumber(ctx, "k", -1); assertEquals(123L, result); result = ContextUtils.getNumber(ctx, "not-found", -1); assertEquals(-1, result); try { ContextUtils.getVariable(ctx, "not-number", null, Number.class); fail("exception expected"); } catch (IllegalArgumentException e) { } result = ContextUtils.assertNumber(ctx, "k"); assertNotNull(result); assertEquals(123L, result); try { ContextUtils.assertNumber(ctx, "not-found"); fail("exception expected"); } catch (IllegalArgumentException e) { } }