@Test public void testMissingNonOptionalParameterNoValue() { Map<String, Variable> variables = new HashMap<>(); Variable integerVariable = new Variable(); variables.put("integer", integerVariable); _thrown.expect(BatfishException.class); String errorMessage = "Missing parameter: integer"; _thrown.expectMessage(equalTo(errorMessage)); Client.checkVariableState(variables); }
static void checkVariableState(Map<String, Variable> variables) throws BatfishException { for (Entry<String, Variable> e : variables.entrySet()) { String variableName = e.getKey(); Variable variable = e.getValue(); if (!variable.getOptional() && variable.getValue() == null) { throw new BatfishException(String.format("Missing parameter: %s", variableName)); } } }
Client extends AbstractClient implements IClient { static void checkVariableState(Map<String, Variable> variables) throws BatfishException { for (Entry<String, Variable> e : variables.entrySet()) { String variableName = e.getKey(); Variable variable = e.getValue(); if (!variable.getOptional() && variable.getValue() == null) { throw new BatfishException(String.format("Missing parameter: %s", variableName)); } } } }
Client extends AbstractClient implements IClient { static void checkVariableState(Map<String, Variable> variables) throws BatfishException { for (Entry<String, Variable> e : variables.entrySet()) { String variableName = e.getKey(); Variable variable = e.getValue(); if (!variable.getOptional() && variable.getValue() == null) { throw new BatfishException(String.format("Missing parameter: %s", variableName)); } } } Client(Settings settings);  Client(String[] args); }
Client extends AbstractClient implements IClient { static void checkVariableState(Map<String, Variable> variables) throws BatfishException { for (Entry<String, Variable> e : variables.entrySet()) { String variableName = e.getKey(); Variable variable = e.getValue(); if (!variable.getOptional() && variable.getValue() == null) { throw new BatfishException(String.format("Missing parameter: %s", variableName)); } } } Client(Settings settings);  Client(String[] args); @Override BatfishLogger getLogger(); Settings getSettings(); void run(List<String> initialCommands); }
Client extends AbstractClient implements IClient { static void checkVariableState(Map<String, Variable> variables) throws BatfishException { for (Entry<String, Variable> e : variables.entrySet()) { String variableName = e.getKey(); Variable variable = e.getValue(); if (!variable.getOptional() && variable.getValue() == null) { throw new BatfishException(String.format("Missing parameter: %s", variableName)); } } } Client(Settings settings);  Client(String[] args); @Override BatfishLogger getLogger(); Settings getSettings(); void run(List<String> initialCommands);  }