Package br.com.six2six.fixturefactory.transformer

Examples of br.com.six2six.fixturefactory.transformer.TransformerChain.transform()


      Class<?> fieldType = ReflectionUtils.invokeRecursiveType(templateHolder.getClazz(), parameterName);
      Object result = arguments.get(parameterName);
      if (result == null) {
        result = processChainedProperty(parameterName, fieldType, arguments)
      }
      values.add(transformerChain.transform(result, fieldType));
    }
    return values;
  }

  protected Object processChainedProperty(String parameterName, Class<?> fieldType, Map<String, Object> arguments) {
View Full Code Here


        value = processor != null ? property.getValue(object, processor) : property.getValue(object);
    } else {
        value = property.getValue();
    }
      TransformerChain transformerChain = buildTransformerChain(new PropertyPlaceholderTransformer(object));
    return transformerChain.transform(value, fieldType);
  }
 
  protected <T> List<String> lookupConstructorParameterNames(Class<T> target, Set<Property> properties) {
    Collection<String> propertyNames = ReflectionUtils.map(properties, "rootAttribute");
    return ReflectionUtils.filterConstructorParameters(target, propertyNames);
View Full Code Here

      Class<?> fieldType = ReflectionUtils.invokeRecursiveType(templateHolder.getClazz(), parameterName);
      Object result = arguments.get(parameterName);
      if (result == null) {
        result = processChainedProperty(parameterName, fieldType, arguments)
      }
      values.add(transformerChain.transform(result, fieldType));
    }
    return values;
  }

  protected Object processChainedProperty(String parameterName, Class<?> fieldType, Map<String, Object> arguments) {
View Full Code Here

        value = processor != null ? property.getValue(object, processor) : property.getValue(object);
    } else {
        value = property.getValue();
    }
      TransformerChain transformerChain = buildTransformerChain(new PropertyPlaceholderTransformer(object));
    return transformerChain.transform(value, fieldType);
  }
 
  protected <T> List<String> lookupConstructorParameterNames(Class<T> target, Set<Property> properties) {
    Collection<String> propertyNames = ReflectionUtils.map(properties, "rootAttribute");
    return ReflectionUtils.filterConstructorParameters(target, propertyNames);
View Full Code Here

public class TransformerChainTest {

    @Test
    public void shouldUseFirstTransformer() {
        TransformerChain transformerChain = new TransformerChain(new FirstTransformer());
        assertEquals("A1", transformerChain.transform("A", String.class));
    }
   
    @Test
    public void shouldUseSecondTransformer() {
        TransformerChain transformerChain = new TransformerChain(new FirstTransformer());
View Full Code Here

   
    @Test
    public void shouldUseSecondTransformer() {
        TransformerChain transformerChain = new TransformerChain(new FirstTransformer());
        transformerChain.add(new SecondTransformer());
        assertEquals("B2", transformerChain.transform("B", String.class));       
    }
   
    @Test
    public void shouldUseBothTransformersInOrderOfInclusion() {
        TransformerChain transformerChain = new TransformerChain(new FirstTransformer());
View Full Code Here

   
    @Test
    public void shouldUseBothTransformersInOrderOfInclusion() {
        TransformerChain transformerChain = new TransformerChain(new FirstTransformer());
        transformerChain.add(new SecondTransformer());
        assertEquals("AB12", transformerChain.transform("AB", String.class));       
    }
   
    @Test
    public void shouldNotUseAnyOfTheTransformers() {
        TransformerChain transformerChain = new TransformerChain(new FirstTransformer());
View Full Code Here

   
    @Test
    public void shouldNotUseAnyOfTheTransformers() {
        TransformerChain transformerChain = new TransformerChain(new FirstTransformer());
        transformerChain.add(new SecondTransformer());
        assertEquals("C", transformerChain.transform("C", String.class));       
    }
}

class FirstTransformer implements Transformer {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.