Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot register Converter for XStream unless I also own the target class. #1009

Closed
rankinc opened this issue May 28, 2016 · 2 comments
Closed

Comments

@rankinc
Copy link
Contributor

rankinc commented May 28, 2016

Hi,

I have a DataTable that I am trying to convert into List<Target>. I've written a suitable TargetConverter for Target, but have discovered that Cucumber won't invoke my Converter unless I also annotate Target with @XStreamConverter. Unfortunately, the Target class is not mine to annotate. Subclassing Target does work, but is fugly.

Is there any other way to associate my Target class with TargetConverter please? If not, perhaps Cucumber could provide a mechanism to do so, e.g. some kind of top-level annotation on the step definition class?

@CustomerConverters({
    @CustomerConverter(value = TargetConverter.class, type = Target.class, priority = 1),
    ...
})
public class MySteps {

    @Given("^we have stuff like:")
    public void setStuff(List<Target> stuff) {
        ...;
    }

}

Or maybe even:

@XStreamConverters(
    @XStreamConverter(TargetConverter.class)
)
@RunWith(Cucumber.class)
public class RunCukesTest {
}

which would probably be clearer. The converters could then be registered with the LocalizedXStreams object up front by passing them to Runtime via RuntimeOptions. Does this sound reasonable, please?

@rankinc
Copy link
Contributor Author

rankinc commented May 29, 2016

See pull request #1010

@lock
Copy link

lock bot commented Oct 25, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Oct 25, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants