### Question:
JazonList { public List<JsonExpectationInput> list() { return list; } JazonList(Predicate<?>... predicates);  JazonList(Object... objects); JazonList with(Object object); JazonList with(Predicate<T> predicate); List<JsonExpectationInput> list();  }### Answer:
@Test void onlySimpleTypes() { JazonList jazonList = new JazonList("orange", 55, false, 173.50, null); List<JsonExpectationInput> list = jazonList.list(); assertEquals(5, list.size()); assertEquals(new ObjectExpectationInput("orange"), list.get(0)); assertEquals(new ObjectExpectationInput(55), list.get(1)); assertEquals(new ObjectExpectationInput(false), list.get(2)); assertEquals(new ObjectExpectationInput(173.50), list.get(3)); assertEquals(new ObjectExpectationInput(null), list.get(4)); }
@Test void nullIsTranslatedToNullPredicate_usingConstructor() { JazonList jazonList = new JazonList(null, null); List<JsonExpectationInput> list = jazonList.list(); assertEquals(2, list.size()); assertEquals(new PredicateExpectationInput<>(null), list.get(0)); }
@Test void onlyPredicates() { JazonList jazonList = new JazonList((Integer it) -> it > 0, (String s) -> s.matches("re.*")); List<JsonExpectationInput> list = jazonList.list(); assertEquals(2, list.size()); PredicateExpectationInput firstPredicateInput = (PredicateExpectationInput) list.get(0); Predicate<Integer> firstPredicate = firstPredicateInput.predicate(); assertFalse(firstPredicate.test(-10)); assertFalse(firstPredicate.test(-1)); assertFalse(firstPredicate.test(0)); assertTrue(firstPredicate.test(1)); assertTrue(firstPredicate.test(10)); PredicateExpectationInput secondPredicateInput = (PredicateExpectationInput) list.get(1); Predicate<String> secondPredicate = secondPredicateInput.predicate(); assertTrue(secondPredicate.test("red")); assertTrue(secondPredicate.test("reindeer")); assertFalse(secondPredicate.test("black")); assertFalse(secondPredicate.test("octopus")); }
@Test void nestedList() { JazonList drinks = new JazonList("pepsi", "coca cola", "sprite"); JazonList birds = new JazonList("pigeon", "sparrow"); JazonList jazonList = new JazonList(drinks, birds); List<JsonExpectationInput> list = jazonList.list(); assertEquals(2, list.size()); assertEquals(new ObjectExpectationInput(drinks), list.get(0)); assertEquals(new ObjectExpectationInput(birds), list.get(1)); }