PigOperationExecution extends Entity { @Override public void validateEntity() { if (Strings.isNullOrEmpty(this.getIdentity()) && (Strings.isNullOrEmpty(this.getJobName()) || Strings.isNullOrEmpty(this.getScriptId()))) throw new IllegalArgumentException( "Either the Entity Id or the jobname and the script id must be " + "provided"); } PigOperationExecution();  PigOperationExecution(String id);  PigOperationExecution(String scriptId, String jobName); @Override void validateEntity(); void setScriptId(String scriptId); void setJobName(String jobName); String getJobName(); String getScriptId(); @Override Map<String, String> getIdAttrsMap();  }
@Test(expected = IllegalArgumentException.class) public void testInvalidPigOperationExecution() { PigOperationExecution pigOperationExecution = new PigOperationExecution(); pigOperationExecution.validateEntity(); }