### Question:
TupleExtractor { public static List<Tuple> extractTuplesFromObject(Object obj) { if ( obj instanceof Iterable ) { Iterable<?> it = (Iterable) obj; return StreamSupport.stream( it.spliterator(), false ) .map( TupleExtractor::extractFromObject ) .collect( Collectors.toList() ); } Tuple tuple = new Tuple(); tuple.put( "result", obj ); return Collections.singletonList( tuple ); } private  TupleExtractor(); static List<Tuple> extractTuplesFromObject(Object obj);  }### Answer:
@Test public void extractTuplesFromObjects() { List<Tuple> tuples = TupleExtractor.extractTuplesFromObject( singleton( new Subject( "value" ) ) ); assertThat( tuples ).hasSize( 1 ); Tuple tuple = tuples.get( 0 ); assertThat( tuple.get( "field" ) ).isEqualTo( "value" ); }
@Test public void extractTuplesFromMaps() { List<Tuple> tuples = TupleExtractor.extractTuplesFromObject( singleton( singletonMap( "field", "value" ) ) ); assertThat( tuples ).hasSize( 1 ); Tuple tuple = tuples.get( 0 ); assertThat( tuple.get( "field" ) ).isEqualTo( "value" ); }
@Test public void extractTuplesFromSingle() { List<Tuple> tuples = TupleExtractor.extractTuplesFromObject( 1 ); assertThat( tuples ).hasSize( 1 ); Tuple tuple = tuples.get( 0 ); assertThat( tuple.get( "result" ) ).isEqualTo( 1 ); }