Utils { public static <P> List<P> extractPayloads(final List<? extends Record<P>> records) { List<P> payloads = new ArrayList<>(); for (Record<P> record : records) { payloads.add(record.getPayload()); } return payloads; } private  Utils(); static void checkNotNull(Object argument, String argumentName); static void checkArgument(boolean assertion, String message); static Map<String, Method> getGetters(final Class<?> type); static String formatTime(LocalDateTime time); static String formatDuration(Duration duration); static String formatErrorThreshold(final long errorThreshold); static List<P> extractPayloads(final List<? extends Record<P>> records); static Class<?> getGenericTypeNameFromTypeConverter(TypeConverter<?, ?> typeConverter, int genericTypeIndex); static final String LINE_SEPARATOR; static final String FILE_SEPARATOR; static final String JAVA_IO_TMPDIR; static final String NOT_APPLICABLE; }
@Test public void testExtractPayloadsFromListOfRecords() { List<Object> list = Utils.extractPayloads(Arrays.asList(record1, record2)); assertThat(list).containsExactly(payload1, payload2); }