@Override
    public boolean validateTree(ValidationContext validationContext) {
        validate(validationContext);
        return (onCancelConfig.validateTree(validationContext) && errors.isEmpty() && !configuration.hasErrors());
    }
@Test
    public void validateTreeShouldVerifyIfOnCancelTasksHasErrors() {
        PluggableTask pluggableTask = new PluggableTask(new PluginConfiguration(), new Configuration());
        pluggableTask.onCancelConfig = mock(OnCancelConfig.class);
        com.thoughtworks.go.domain.Task cancelTask = mock(com.thoughtworks.go.domain.Task.class);

        when(pluggableTask.onCancelConfig.getTask()).thenReturn(cancelTask);
        when(cancelTask.hasCancelTask()).thenReturn(false);
        when(pluggableTask.onCancelConfig.validateTree(null)).thenReturn(false);

        assertFalse(pluggableTask.validateTree(null));
    }