| 8 | import java.util.stream.*; |
| 9 | |
| 10 | class Part implements Supplier<Part> { |
| 11 | @Override public String toString() { |
| 12 | return getClass().getSimpleName(); |
| 13 | } |
| 14 | static List<Supplier<? extends Part>> prototypes = |
| 15 | Arrays.asList( |
| 16 | new FuelFilter(), |
| 17 | new AirFilter(), |
| 18 | new CabinAirFilter(), |
| 19 | new OilFilter(), |
| 20 | new FanBelt(), |
| 21 | new PowerSteeringBelt(), |
| 22 | new GeneratorBelt() |
| 23 | ); |
| 24 | private static Random rand = new Random(47); |
| 25 | @Override public Part get() { |
| 26 | int n = rand.nextInt(prototypes.size()); |
| 27 | return prototypes.get(n).get(); |
| 28 | } |
| 29 | } |
| 30 | |
| 31 | class Filter extends Part {} |
| 32 |
nothing calls this directly
no outgoing calls
no test coverage detected