Skip to content

Commit

Permalink
JBEHAVE-1489 Add ability to build converters chain by their source an…
Browse files Browse the repository at this point in the history
…d target types
  • Loading branch information
uarlouski committed May 27, 2021
1 parent c2ab2d7 commit 482b1ff
Show file tree
Hide file tree
Showing 7 changed files with 146 additions and 105 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
import java.util.Calendar;

import org.apache.commons.lang3.StringUtils;
import org.jbehave.core.steps.ParameterConverters.AbstractParameterConverter;
import org.jbehave.core.steps.ParameterConverters.FromStringParameterConverter;

public class CalendarConverter extends AbstractParameterConverter<Calendar> {
public class CalendarConverter extends FromStringParameterConverter<Calendar> {

private final SimpleDateFormat dateFormat;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

import java.lang.reflect.Type;

import org.jbehave.core.steps.ParameterConverters.AbstractParameterConverter;
import org.jbehave.core.steps.ParameterConverters.FromStringParameterConverter;
import org.jbehave.core.steps.ParameterConverters.ParameterConversionFailed;
import org.jbehave.examples.core.model.Trader;
import org.jbehave.examples.core.persistence.TraderPersister;

public class TraderConverter extends AbstractParameterConverter<Trader> {
public class TraderConverter extends FromStringParameterConverter<Trader> {
private TraderPersister persister;

public TraderConverter(TraderPersister persister) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@

import org.jbehave.core.annotations.AsParameterConverter;
import org.jbehave.core.configuration.Configuration;
import org.jbehave.core.steps.ParameterConverters.MethodReturningConverter;
import org.jbehave.core.steps.ParameterConverters.ParameterConverter;
import org.jbehave.core.steps.ParameterConverters.MethodReturningConverter;

/**
* <p>
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
import org.jbehave.core.model.Verbatim;
import org.jbehave.core.parsers.StepMatcher;
import org.jbehave.core.reporters.StoryReporter;
import org.jbehave.core.steps.ParameterConverters.ParameterConverter;
import org.jbehave.core.steps.ParameterConverters.FromStringParameterConverter;
import org.jbehave.core.steps.context.StepsContext;

public class StepCreator {
Expand Down Expand Up @@ -763,7 +763,7 @@ public StepResult doNotPerform(StoryReporter storyReporter, UUIDExceptionWrapper
return perform(storyReporter, storyFailureIfItHappened);
}

private class UUIDExceptionWrapperInjector implements ParameterConverter<UUIDExceptionWrapper> {
private class UUIDExceptionWrapperInjector extends FromStringParameterConverter<UUIDExceptionWrapper> {
private final UUIDExceptionWrapper storyFailureIfItHappened;

public UUIDExceptionWrapperInjector(UUIDExceptionWrapper storyFailureIfItHappened) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import org.jbehave.core.embedder.EmbedderControls;
import org.jbehave.core.i18n.LocalizedKeywords;
import org.jbehave.core.steps.CandidateSteps;
import org.jbehave.core.steps.ParameterConverters.ParameterConverter;
import org.jbehave.core.steps.ParameterConverters.FromStringParameterConverter;
import org.jbehave.core.steps.Steps;
import org.jbehave.core.steps.scan.GivenOnly;
import org.jbehave.core.steps.scan.GivenWhen;
Expand Down Expand Up @@ -188,7 +188,7 @@ static class Annotated {

}

static class MyParameterConverter implements ParameterConverter<String> {
static class MyParameterConverter extends FromStringParameterConverter<String> {

@Override
public boolean canConvertTo(Type type) {
Expand Down

Large diffs are not rendered by default.

0 comments on commit 482b1ff

Please sign in to comment.