uk.co.it.modular.beans.InstanceAdapters Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of test-object-builder Show documentation
Show all versions of test-object-builder Show documentation
A library to support configurable instantiation and creation of random objects to use as test dummy's for model objects
The newest version!
package uk.co.it.modular.beans;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
/**
* Colleciton of adapter to functions to convert {@link ValueFactory} to {@link org.exparity.test.builder.ValueFactories.ValueFactory}
*
* @author Stewart Bissett
*/
@Deprecated
abstract class InstanceAdapters {
static InstanceFactory adapt(final org.exparity.test.builder.ValueFactory from) {
return new InstanceFactory() {
public T createValue() {
return from.createValue();
}
};
}
static Collection> adapt(final Collection> from) {
List> adapted = new ArrayList>();
for (InstanceFactory toadapt : from) {
adapted.add(InstanceAdapters.adapt(toadapt));
}
return adapted;
}
static org.exparity.test.builder.ValueFactory adapt(final InstanceFactory from) {
return new org.exparity.test.builder.ValueFactory() {
public T createValue() {
return from.createValue();
}
};
}
static ArrayFactory adapt(final org.exparity.test.builder.ArrayFactory from) {
return new ArrayFactory() {
public A[] createValue(final Class type, final int size) {
return from.createValue(type, size);
}
};
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy