### Question:
GraphOperation extends AbstractOperation { @Override public int outputListLength(final String name) { Graph.Reference r = graph.ref(); try { return outputListLength(getUnsafeNativeHandle(), name); } finally { r.close(); } } GraphOperation(Graph g, TF_Operation unsafeNativeHandle); @Override String name(); @Override String type(); @Override int numOutputs(); @Override int outputListLength(final String name); @Override int hashCode(); @Override boolean equals(Object o); @Override int inputListLength(final String name);  }### Answer:
@Test public void outputListLengthFailsOnInvalidName() { try (Graph g = new Graph()) { Ops tf = Ops.create(g); Operation op = tf.math.add(tf.constant(1), tf.constant(2)).op(); assertEquals(1, op.outputListLength("z")); try { op.outputListLength("unknown"); fail("Did not catch bad name"); } catch (TFInvalidArgumentException iae) { } } }
@Test public void outputListLength() { try (Graph g = new Graph()) { Ops tf = Ops.create(g); assertEquals(1, tf.split(tf.constant(0), tf.array(0, 1), 1L).op().outputListLength("output")); assertEquals(2, tf.split(tf.constant(0), tf.array(0, 1), 2L).op().outputListLength("output")); assertEquals(3, tf.split(tf.constant(0), tf.array(0, 1, 2), 3L).op().outputListLength("output")); } }