### Question:
NonEmptyList extends AbstractList<A> { public static <A> Optional<NonEmptyList<A>> fromList(List<A> l) { if (l.size() < 1) return Optional.empty(); if (l.size() == 1) { return Optional.of(NonEmptyList.of(l.get(0))); } return Optional.of(new NonEmptyList<>(l.get(0), l.subList(1, l.size()))); } NonEmptyList(final A head, final List<A> tail); @SafeVarargs static NonEmptyList<A> of(final A a, final A... as); static Optional<NonEmptyList<A>> fromList(List<A> l); @Override A get(final int index); @Override int size(); @Override boolean removeIf(final Predicate<? super A> filter); @Override void replaceAll(final UnaryOperator<A> operator); @Override void sort(final Comparator<? super A> c); NonEmptyList<B> map(final Function<A, B> op); A head(); A last(); List<A> tail(); List<A> toList(); B fold(final Function<A, B> initialResult, final BiFunction<B, A, B> op); B foldLeft(final B b, final BiFunction<B, A, B> op);  }### Answer:
@Test void fromListShouldNotCreateNELFromEmptyList() { Optional<NonEmptyList<Integer>> oList = NonEmptyList.fromList(new ArrayList<>()); assertThat(oList.isPresent()).isFalse(); }