Hi,

making the methods protected means losing the possibility of changing their implementation without potentially breaking backward compat. Those methods are private for a reason. Some methods are intended to be extensible, other not.

You should instead be using the public methods of the classes/interfaces of the underlying components. It looks like you need to collect/list steps, so you can use the StepCollector interface or the StepCreator class.

If you need to expose some specific functionality that is not currently accessible via the interface methods, we can extend the interface.

Cheers

On 10/11/2014 11:39, Willemijn Wouters wrote:
Hello,

Unitils has a testlistener, just like JUnit.
Some methods of the testlistener must be executed before the @BeforeScenarios, some of the methods must be executed after the @BeforeScenarios.
To give you an idea:
@Override
public List<BeforeOrAfterStep> listBeforeOrAfterScenario(ScenarioType type) { List<BeforeOrAfterStep> steps = new ArrayList<BeforeOrAfterStep>();
        StepCreator stepCreator = createStepCreator();
        InjectableStepsFactory stepsFactory = getStepsFactory();

steps.addAll(UnitilsStepsFactory.createBeforeTestClassStep(stepCreator, stepsFactory, type())); steps.addAll(UnitilsStepsFactory.createAfterCreateTestObject(stepCreator, stepsFactory, type())); steps.addAll(UnitilsStepsFactory.createBeforeTestSetUp(stepCreator, stepsFactory, type()));

steps.addAll(scenarioStepsHaving(type, Stage.BEFORE, BeforeScenario.class)); steps.addAll(UnitilsStepsFactory.createBeforeTestMethod(stepCreator, stepsFactory, type())); steps.addAll(UnitilsStepsFactory.createAfterTestMethod(stepCreator, stepsFactory, type())); steps.addAll(scenarioStepsHaving(type, Stage.AFTER, AfterScenario.class, ANY, SUCCESS, FAILURE)); steps.addAll(UnitilsStepsFactory.createAfterTestTearDown(stepCreator, stepsFactory, type()));
        return Collections.unmodifiableList(steps);
    }

We have find a way to make it work, but it wasn't easy because of the private methods/classes. I couldn't make @BeforeScenarios in a seperate step because these Unitils steps needs the be executed in the correct order and Unitils needs to know which step is executed because it injects objects into the steps fields.

So this was the only solution to make everything work with Unitils.
Is it possible to make these methods/classes protected?
/The following methods of //org.jbehave.core.steps.Steps:/

oorg.jbehave.core.steps.Steps.scenarioStepsHaving(ScenarioType, Stage, Class<? extends Annotation>, Outcome...)

oorg.jbehave.core.steps.Steps.createBeforeOrAfterStep(Stage, Method)

oorg.jbehave.core.steps.Steps.createBeforeOrAfterStep(Stage, Method)

oorg.jbehave.core.steps.Steps.scenarioOutcome(Method, Class<? extends Annotation>)

oorg.jbehave.core.steps.Steps.createCandidate(Method, StepType, String, int, Configuration)

/The following methods in //org.jbehave.core.steps.InstanceStepsFactory: /org.jbehave.core.steps.AbstractStepsFactory.methodReturningConverters(Class<?>)

/The following classes/methods in //org.jbehave.core.steps.StepCreator:/

oall the inner classes

oorg.unitils.jbehave.core.stepcreator.UnitilsStepCreator.StepCreatorBeforeOrAfterStep.paramConvertersWithExceptionInjector(UUIDExceptionWrapper)

Thanks
Willemijn Wouters

2014-11-07 19:56 GMT+01:00 Mauro Talevi <mauro.tal...@aquilonia.org <mailto:mauro.tal...@aquilonia.org>>:

    Hi,

    the methods are private because they are internal and not meant to
    be an API.

    Can you explain what you're trying to do?

    Cheers

    On 7 Nov 2014, at 11:35, Willemijn Wouters
    <wouters.willemij...@gmail.com
    <mailto:wouters.willemij...@gmail.com>> wrote:

    Hello,

    I work on a opensource project called Unitils
    <http://unitils.org/summary.html> and at the moment we are
    working on a project called unitils-jbehave
    <https://sourceforge.net/projects/unitilsjbehave/>.
    Unitils-jbehave is the glue between Unitils & JBehave.
    But we have had some difficulties because of the fact that so
    many things are private.

    Is it possible to put the following things on 'protected'?

    /The following methods of //org.jbehave.core.steps.Steps:/

    oorg.jbehave.core.steps.Steps.scenarioStepsHaving(ScenarioType,
    Stage, Class<? extends Annotation>, Outcome...)

    oorg.jbehave.core.steps.Steps.createBeforeOrAfterStep(Stage, Method)

    oorg.jbehave.core.steps.Steps.createBeforeOrAfterStep(Stage, Method)

    oorg.jbehave.core.steps.Steps.scenarioOutcome(Method, Class<?
    extends Annotation>)

    oorg.jbehave.core.steps.Steps.createCandidate(Method, StepType,
    String, int, Configuration)

    /The following methods in
    //org.jbehave.core.steps.InstanceStepsFactory:
    
/org.jbehave.core.steps.AbstractStepsFactory.methodReturningConverters(Class<?>)

    /The following classes/methods in
    //org.jbehave.core.steps.StepCreator:/

    oall the inner classes

    
oorg.unitils.jbehave.core.stepcreator.UnitilsStepCreator.StepCreatorBeforeOrAfterStep.paramConvertersWithExceptionInjector(UUIDExceptionWrapper)


    Thanks.



Reply via email to