ExecutorSettingsLoader { public static ExecutorConfig read(Readable input) throws ExecutorConfigException { String configContents; try { configContents = CharStreams.toString(input); } catch (IOException e) { throw new ExecutorConfigException(e); } ObjectMapper mapper = new ObjectMapper() .registerModule(new ProtobufModule()) .setPropertyNamingStrategy(CAMEL_CASE_TO_LOWER_CASE_WITH_UNDERSCORES); Schema parsed; try { parsed = mapper.readValue(configContents, Schema.class); } catch (IOException e) { throw new ExecutorConfigException(e); } ExecutorInfo executorInfo; try { executorInfo = parsed.executor.setExecutorId(PLACEHOLDER_EXECUTOR_ID).build(); } catch (UninitializedMessageException e) { throw new ExecutorConfigException(e); } return new ExecutorConfig( executorInfo, Optional.fromNullable(parsed.volumeMounts).or(ImmutableList.of())); } private  ExecutorSettingsLoader(); static ExecutorConfig read(Readable input); static final ExecutorID PLACEHOLDER_EXECUTOR_ID; }
@Test(expected = ExecutorConfigException.class) public void testInvalidJson() throws Exception { ExecutorSettingsLoader.read(new StringReader("this is not json")); }