import java.util.ArrayList;
import java.util.List;
public class OneToManyTest extends DatastoreTest {
public void testCopyDtoWithOneToMany() {
final Dto dto = new Dto();
dto.setModule(Offering.class.getSimpleName());
final ArrayList<Dto> uniqueServices = new ArrayList<Dto>();
uniqueServices.add(getDtoService(UniqueService.class.getSimpleName()));
final ArrayList<Dto> recurringServices = new ArrayList<Dto>();
recurringServices.add(getDtoService(RecurringService.class.getSimpleName()));
dto.set("uniqueServices", uniqueServices);
dto.set("recurringServices", recurringServices);
final long id = createService.create(dto);
final Dto offering = readService.get(Offering.class.getSimpleName(), id);
assertEquals(1, ((List<?>) offering.get("uniqueServices")).size());
assertEquals(1, ((List<?>) offering.get("recurringServices")).size());
}