### Question:
DataSetUtil { @Nonnull public static String getOptionOrThrow(@Nonnull final DataSetOptions options, @Nonnull final String key, @Nullable final String errorMessage) { final Option<String> value = options.getOption(key); if (value.isDefined()) { return value.get(); } else { throw new MissingOptionException((errorMessage == null) ? "Missing required option: " + key : errorMessage); } } private  DataSetUtil(); @Nonnull static String getOptionOrThrow(@Nonnull final DataSetOptions options, @Nonnull final String key, @Nullable final String errorMessage);  }### Answer:
@Test public void getOptionDefined() { final DataSetOptions options = new DataSetOptions(); options.setOption("key", "value"); Assert.assertEquals("value", DataSetUtil.getOptionOrThrow(options, "key", null)); }
@Test(expected = MissingOptionException.class) public void getOptionUndefined() { DataSetUtil.getOptionOrThrow(new DataSetOptions(), "key", null); }