()
| 14 | // The different types of Pet to create: |
| 15 | public abstract List<Class<? extends Pet>> types(); |
| 16 | @Override public Pet get() { // Create one random Pet |
| 17 | int n = rand.nextInt(types().size()); |
| 18 | try { |
| 19 | return types().get(n) |
| 20 | .getConstructor().newInstance(); |
| 21 | } catch(InstantiationException | |
| 22 | NoSuchMethodException | |
| 23 | InvocationTargetException | |
| 24 | IllegalAccessException e) { |
| 25 | throw new RuntimeException(e); |
| 26 | } |
| 27 | } |
| 28 | public Stream<Pet> stream() { |
| 29 | return Stream.generate(this); |
| 30 | } |
nothing calls this directly
no test coverage detected