BeanPropertyArgumentTransformer extends ArgTransformerEventDescriptionBuilder { @Override public final Object[] transformArguments(Object[] arguments) { if (arguments == null) { return new Object[] {}; } List<Object> resultList = new ArrayList<>(); for (Object argument : arguments) { resultList.addAll(transformSingleArgument(argument)); } return resultList.toArray(); }  @Override final Object[] transformArguments(Object[] arguments); @Override Object transformReturnValue(Object returnValue);  }
@Test public void transformsBeanPropertiesToArguments() { Object[] transformedArguments = builder.transformArguments(new Object[] { bean }); assertTrue(transformedArguments.length >= 2); assertTrue(ArrayUtils.contains(transformedArguments, foo)); assertTrue(ArrayUtils.contains(transformedArguments, bar)); }
@Test public void transformsAllArgumentsBeanProperties() { Object[] transformedArguments = builder.transformArguments(new Object[] { new Object(), bean }); assertTrue(transformedArguments.length >= 2); assertTrue(ArrayUtils.contains(transformedArguments, foo)); assertTrue(ArrayUtils.contains(transformedArguments, bar)); }
@Test public void handlesNullArguments() { Object[] transformedArguments = builder.transformArguments(new Object[] { null }); assertEquals(0, transformedArguments.length); }
@Test public void handlesNullArray() { Object[] transformedArguments = builder.transformArguments(null); assertEquals(0, transformedArguments.length); }