@Test(expectedExceptions = NullPointerException.class) public void testHandlePieEventNullValue() throws Exception { PieExecutorTaskFactory instance = new PieExecutorTaskFactory(); instance.getTask(null); }
@Override public IPieEventTask getTask(IPieEvent event) throws PieExecutorTaskFactoryException { Validate.notNull(event); Class taskClass = this.tasks.get(event.getClass()); try { Validate.notNull(taskClass); } catch (NullPointerException ex) { PieLogger.info(this.getClass(), "No task registered for given event: {}", event.getClass(), ex); throw new PieExecutorTaskFactoryException("No task registered for given event!", ex); } IPieEventTask task = null; try { task = (IPieEventTask) this.beanService.getBean(taskClass); } catch (BeanServiceError ex) { throw new PieExecutorTaskFactoryException("Could not create task!", ex); } task.setEvent(event); return task; }
PieExecutorTaskFactory implements IPieExecutorTaskFactory { @Override public IPieEventTask getTask(IPieEvent event) throws PieExecutorTaskFactoryException { Validate.notNull(event); Class taskClass = this.tasks.get(event.getClass()); try { Validate.notNull(taskClass); } catch (NullPointerException ex) { PieLogger.info(this.getClass(), "No task registered for given event: {}", event.getClass(), ex); throw new PieExecutorTaskFactoryException("No task registered for given event!", ex); } IPieEventTask task = null; try { task = (IPieEventTask) this.beanService.getBean(taskClass); } catch (BeanServiceError ex) { throw new PieExecutorTaskFactoryException("Could not create task!", ex); } task.setEvent(event); return task; } }
PieExecutorTaskFactory implements IPieExecutorTaskFactory { @Override public IPieEventTask getTask(IPieEvent event) throws PieExecutorTaskFactoryException { Validate.notNull(event); Class taskClass = this.tasks.get(event.getClass()); try { Validate.notNull(taskClass); } catch (NullPointerException ex) { PieLogger.info(this.getClass(), "No task registered for given event: {}", event.getClass(), ex); throw new PieExecutorTaskFactoryException("No task registered for given event!", ex); } IPieEventTask task = null; try { task = (IPieEventTask) this.beanService.getBean(taskClass); } catch (BeanServiceError ex) { throw new PieExecutorTaskFactoryException("Could not create task!", ex); } task.setEvent(event); return task; }  }
PieExecutorTaskFactory implements IPieExecutorTaskFactory { @Override public IPieEventTask getTask(IPieEvent event) throws PieExecutorTaskFactoryException { Validate.notNull(event); Class taskClass = this.tasks.get(event.getClass()); try { Validate.notNull(taskClass); } catch (NullPointerException ex) { PieLogger.info(this.getClass(), "No task registered for given event: {}", event.getClass(), ex); throw new PieExecutorTaskFactoryException("No task registered for given event!", ex); } IPieEventTask task = null; try { task = (IPieEventTask) this.beanService.getBean(taskClass); } catch (BeanServiceError ex) { throw new PieExecutorTaskFactoryException("Could not create task!", ex); } task.setEvent(event); return task; }  void setBeanService(IBeanService beanService); void setTasks(Map<Class, Class> tasks); @Override IPieEventTask getTask(IPieEvent event); @Override void registerTask(Class<X> event, Class<T> task); @Override void removeTaskRegistration(Class<P> event); }
PieExecutorTaskFactory implements IPieExecutorTaskFactory { @Override public IPieEventTask getTask(IPieEvent event) throws PieExecutorTaskFactoryException { Validate.notNull(event); Class taskClass = this.tasks.get(event.getClass()); try { Validate.notNull(taskClass); } catch (NullPointerException ex) { PieLogger.info(this.getClass(), "No task registered for given event: {}", event.getClass(), ex); throw new PieExecutorTaskFactoryException("No task registered for given event!", ex); } IPieEventTask task = null; try { task = (IPieEventTask) this.beanService.getBean(taskClass); } catch (BeanServiceError ex) { throw new PieExecutorTaskFactoryException("Could not create task!", ex); } task.setEvent(event); return task; }  void setBeanService(IBeanService beanService); void setTasks(Map<Class, Class> tasks); @Override IPieEventTask getTask(IPieEvent event); @Override void registerTask(Class<X> event, Class<T> task); @Override void removeTaskRegistration(Class<P> event);  }