in testing/unittestsupport/applib/src/main/java/org/apache/causeway/testing/unittestsupport/applib/dom/pojo/PojoTester.java [139:388]
protected PojoTester() {
final var booleanDatumFactory = new DatumFactoryImpl<>(Boolean.class) {
@Override
public Boolean getNext() {
return counter.getAndIncrement() == 0;
}
private final AtomicInteger counter = new AtomicInteger();
};
usingData(boolean.class, booleanDatumFactory);
usingData(Boolean.class, booleanDatumFactory);
final var byteDatumFactory = new DatumFactoryImpl<>(Byte.class) {
@Override
public Byte getNext() {
return (byte) counter.getAndIncrement();
}
private final AtomicInteger counter = new AtomicInteger();
};
usingData(byte.class, byteDatumFactory);
usingData(Byte.class, byteDatumFactory);
final var shortDatumFactory = new DatumFactoryImpl<>(Short.class) {
@Override
public Short getNext() {
return (short) counter.getAndIncrement();
}
private final AtomicInteger counter = new AtomicInteger();
};
usingData(short.class, shortDatumFactory);
usingData(Short.class, shortDatumFactory);
final var charDatumFactory = new DatumFactoryImpl<>(Character.class) {
@Override
public Character getNext() {
return (char) counter.getAndIncrement();
}
private final AtomicInteger counter = new AtomicInteger();
};
usingData(char.class, charDatumFactory);
usingData(Character.class, charDatumFactory);
final var intDatumFactory = new DatumFactoryImpl<>(Integer.class) {
@Override
public Integer getNext() {
return counter.getAndIncrement();
}
private final AtomicInteger counter = new AtomicInteger();
};
usingData(int.class, intDatumFactory);
usingData(Integer.class, intDatumFactory);
final var longDatumFactory = new DatumFactoryImpl<>(Long.class) {
@Override
public Long getNext() {
return (long) counter.getAndIncrement();
}
private final AtomicInteger counter = new AtomicInteger();
};
usingData(long.class, longDatumFactory);
usingData(Long.class, longDatumFactory);
final var floatDatumFactory = new DatumFactoryImpl<>(Float.class) {
@Override
public Float getNext() {
return (float) counter.getAndIncrement();
}
private final AtomicInteger counter = new AtomicInteger();
};
usingData(float.class, floatDatumFactory);
usingData(Float.class, floatDatumFactory);
final var doubleDatumFactory = new DatumFactoryImpl<>(Double.class) {
@Override
public Double getNext() {
return (double) counter.getAndIncrement();
}
private final AtomicInteger counter = new AtomicInteger();
};
usingData(double.class, doubleDatumFactory);
usingData(Double.class, doubleDatumFactory);
usingData(new DatumFactoryImpl<>(String.class) {
@Override
public String getNext() {
return "string" + counter.getAndIncrement();
}
private final AtomicInteger counter = new AtomicInteger();
});
usingData(new DatumFactoryImpl<>(BigDecimal.class) {
@Override
public BigDecimal getNext() {
return new BigDecimal(counter.getAndIncrement());
}
private final AtomicInteger counter = new AtomicInteger();
});
usingData(new DatumFactoryImpl<>(BigInteger.class) {
@Override
public BigInteger getNext() {
return BigInteger.valueOf(counter.getAndIncrement());
}
private final AtomicInteger counter = new AtomicInteger();
});
usingData(new DatumFactoryImpl<>(Date.class) {
@Override
public Date getNext() {
return new Date(counter.getAndIncrement());
}
private final AtomicInteger counter = new AtomicInteger();
});
usingData(new DatumFactoryImpl<>(Timestamp.class) {
@Override
public Timestamp getNext() {
return new Timestamp(counter.getAndIncrement());
}
private final AtomicInteger counter = new AtomicInteger();
});
usingData(new DatumFactoryImpl<>(Pattern.class) {
@Override
public Pattern getNext() {
return Pattern.compile("p" + counter.getAndIncrement());
}
private final AtomicInteger counter = new AtomicInteger();
});
usingData(new DatumFactoryImpl<>(File.class) {
@Override
public File getNext() {
return new File("file" + counter.getAndIncrement());
}
private final AtomicInteger counter = new AtomicInteger();
});
final var listDatumFactory = new DatumFactoryImpl<List<?>>() {
@Override
public List<?> getNext() {
final List<String> list = new ArrayList<>();
list.add("element" + counter.getAndIncrement());
list.add("element" + counter.getAndIncrement());
list.add("element" + counter.getAndIncrement());
return list;
}
private final AtomicInteger counter = new AtomicInteger();
};
usingData(Iterable.class, listDatumFactory);
usingData(Collection.class, listDatumFactory);
usingData(List.class, listDatumFactory);
usingData(new DatumFactoryImpl<Set<?>>() {
@Override
public Set<?> getNext() {
final Set<String> list = new HashSet<>();
list.add("element" + counter.getAndIncrement());
list.add("element" + counter.getAndIncrement());
list.add("element" + counter.getAndIncrement());
return list;
}
private final AtomicInteger counter = new AtomicInteger();
});
usingData(new DatumFactoryImpl<SortedSet<?>>() {
@Override
public SortedSet<?> getNext() {
final SortedSet<String> list = new TreeSet<>();
list.add("element" + counter.getAndIncrement());
list.add("element" + counter.getAndIncrement());
list.add("element" + counter.getAndIncrement());
return list;
}
private final AtomicInteger counter = new AtomicInteger();
});
usingData(new DatumFactoryImpl<byte[]>() {
@Override
public byte[] getNext() {
return new byte[]{ (byte) counter.getAndIncrement() };
}
private final AtomicInteger counter = new AtomicInteger();
});
usingData(new DatumFactoryImpl<char[]>() {
@Override
public char[] getNext() {
return new char[]{ (char) counter.getAndIncrement() };
}
private final AtomicInteger counter = new AtomicInteger();
});
usingData(Blob.class,
new Blob("foo", "application/pdf", new byte[]{1,2,3}),
new Blob("bar", "application/docx", new byte[]{4,5}),
new Blob("baz", "application/xlsx", new byte[]{7,8,9,0}));
usingData(Clob.class,
new Clob("foo", "text/html", "<html/>".toCharArray()),
new Clob("bar", "text/plain", "hello world".toCharArray()),
new Clob("baz", "text/ini", "foo=bar".toCharArray()));
usingData(LocalTime.class,
LocalTime.of(11, 15),
LocalTime.of(12, 20),
LocalTime.of(13, 30),
LocalTime.of(14, 45));
usingData(LocalDate.class,
LocalDate.of(2012, 7, 19),
LocalDate.of(2012, 7, 20),
LocalDate.of(2012, 8, 19),
LocalDate.of(2013, 7, 19));
usingData(LocalDateTime.class,
LocalDateTime.of(2012, 7, 19, 11, 15),
LocalDateTime.of(2012, 7, 20, 12, 20),
LocalDateTime.of(2012, 8, 19, 13, 30),
LocalDateTime.of(2013, 7, 19, 14, 45));
usingData(OffsetDateTime.class,
OffsetDateTime.of(2012, 7, 19, 11, 15, 0, 0, ZoneOffset.UTC),
OffsetDateTime.of(2012, 7, 20, 12, 20, 0, 0, ZoneOffset.UTC),
OffsetDateTime.of(2012, 8, 19, 13, 30, 0, 0, ZoneOffset.UTC),
OffsetDateTime.of(2013, 7, 19, 14, 45, 0, 0, ZoneOffset.UTC));
usingData(org.joda.time.LocalDate.class,
new org.joda.time.LocalDate(2012, 7, 19),
new org.joda.time.LocalDate(2012, 7, 20),
new org.joda.time.LocalDate(2012, 8, 19),
new org.joda.time.LocalDate(2013, 7, 19)
);
usingData(org.joda.time.LocalTime.class,
new org.joda.time.LocalTime(7, 19, 11, 15),
new org.joda.time.LocalTime(7, 20, 12, 20),
new org.joda.time.LocalTime(8, 19, 13, 30),
new org.joda.time.LocalTime(7, 19, 14, 45)
);
usingData(org.joda.time.LocalDateTime.class,
new org.joda.time.LocalDateTime(2012, 7, 19, 11, 15),
new org.joda.time.LocalDateTime(2012, 7, 20, 12, 20),
new org.joda.time.LocalDateTime(2012, 8, 19, 13, 30),
new org.joda.time.LocalDateTime(2013, 7, 19, 14, 45)
);
usingData(DateTime.class,
new org.joda.time.DateTime(2012, 7, 19, 11, 15),
new org.joda.time.DateTime(2012, 7, 20, 12, 20),
new org.joda.time.DateTime(2012, 8, 19, 13, 30),
new org.joda.time.DateTime(2013, 7, 19, 14, 45)
);
}