### Question:
EagerOperationBuilder implements OperationBuilder { @Override public EagerOperationBuilder setAttr(String name, String value) { return setAttr(name, value.getBytes(StandardCharsets.UTF_8)); } EagerOperationBuilder(EagerSession session, String type, String name); @Override EagerOperation build(); @Override EagerOperationBuilder addInput(Output<?> input); @Override EagerOperationBuilder addInputList(Output<?>[] inputs); @Override OperationBuilder addControlInput(Operation control); @Override EagerOperationBuilder setDevice(String device); @Override EagerOperationBuilder setAttr(String name, String value); @Override EagerOperationBuilder setAttr(String name, String[] values); @Override EagerOperationBuilder setAttr(String name, byte[] values); @Override EagerOperationBuilder setAttr(String name, long value); @Override EagerOperationBuilder setAttr(String name, long[] values); @Override EagerOperationBuilder setAttr(String name, float value); @Override EagerOperationBuilder setAttr(String name, float[] values); @Override EagerOperationBuilder setAttr(String name, boolean value); @Override EagerOperationBuilder setAttr(String name, boolean[] values); @Override EagerOperationBuilder setAttr(String name, DataType<?> value); @Override EagerOperationBuilder setAttr(String name, DataType<?>[] values); @Override EagerOperationBuilder setAttr(String name, Tensor<?> value); @Override EagerOperationBuilder setAttr(String name, Tensor<?>[] values); @Override EagerOperationBuilder setAttr(String name, Shape value); @Override EagerOperationBuilder setAttr(String name, Shape[] values);  }### Answer:
@Test public void failToBuildOpIfSessionIsClosed() { EagerOperationBuilder opBuilder; try (EagerSession session = EagerSession.create()) { opBuilder = new EagerOperationBuilder(session, "Empty", "empty"); } try { opBuilder.setAttr("dtype", TFloat32.DTYPE); fail(); } catch (IllegalStateException e) { } }