@Override public void validate() { if (namespace == null || namespace.isEmpty()) { throw new IllegalArgumentException("Namespace must be specified"); } if (application == null || application.isEmpty()) { throw new IllegalArgumentException("Application must be specified"); } if (type == null || type.isEmpty()) { throw new IllegalArgumentException("Program type must be specified"); } if (name == null || name.isEmpty()) { throw new IllegalArgumentException("Program name must be specified"); } getId(); } }
@Test public void testMissingFieldsThrowsException() { ProgramStarter.Arguments arguments = new ProgramStarter.Arguments(null, "app", "WORKFLOW", "name"); try { arguments.validate(); Assert.fail("arguments should have been invalidated."); } catch (IllegalArgumentException e) { arguments = new ProgramStarter.Arguments("ns", null, "WORKFLOW", "name"); try { arguments.validate(); Assert.fail("arguments should have been invalidated."); } catch (IllegalArgumentException e) { arguments = new ProgramStarter.Arguments("ns", "app", null, "name"); try { arguments.validate(); Assert.fail("arguments should have been invalidated."); } catch (IllegalArgumentException e) { arguments = new ProgramStarter.Arguments("ns", "app", "WORKFLOW", null); try { arguments.validate(); Assert.fail("arguments should have been invalidated."); } catch (IllegalArgumentException e) {
@Override public void validate() { if (namespace == null || namespace.isEmpty()) { throw new IllegalArgumentException("Namespace must be specified"); } if (application == null || application.isEmpty()) { throw new IllegalArgumentException("Application must be specified"); } if (type == null || type.isEmpty()) { throw new IllegalArgumentException("Program type must be specified"); } if (name == null || name.isEmpty()) { throw new IllegalArgumentException("Program name must be specified"); } getId(); } }
@Test(expected = IllegalArgumentException.class) public void invalidProgramTypeThrowsException() { ProgramStarter.Arguments arguments = new ProgramStarter.Arguments("ns", "app", "PORKFLOW", "name"); arguments.validate(); }