blob: 98e9038eecb6cd14a4ee546117c1a7a707f4918c [file] [log] [blame]
package junitparams.converters;
public class NullableConverter implements Converter<Nullable, String>{
private String nullIdentifier;
public void initialize(Nullable annotation) {
nullIdentifier = annotation.nullIdentifier() == null ? "null" : annotation.nullIdentifier();
}
public String convert(Object param) throws ConversionFailedException {
if(param instanceof String && ((String)param).trim().equalsIgnoreCase(nullIdentifier)){
return null;
}
return (String)param;
}
}