### Question:
ISOField extends ISOComponent implements Cloneable, Externalizable { @Override public void writeExternal (ObjectOutput out) throws IOException { out.writeShort (fieldNumber); out.writeUTF (value); } ISOField();  ISOField(int n);  ISOField(int n, String v); @Override byte[] pack(); @Override int unpack(byte[] b); @Override void unpack(InputStream in); @Override Object getKey(); @Override Object getValue(); @Override void setValue(Object obj); @Override byte[] getBytes(); @Override void dump(PrintStream p, String indent); @Override void setFieldNumber(int fieldNumber); @Override int getFieldNumber(); @Override void writeExternal(ObjectOutput out); @Override void readExternal(ObjectInput in);  }### Answer:
@Test public void testWriteExternal() throws Throwable { ObjectOutput out = new ObjectOutputStream(new ByteArrayOutputStream()); new ISOVField(new ISOField(100, "testISOFieldv"), new ISOVError("testISOFieldDescription", "testISOFieldRejectCode")) .writeExternal(out); }
@Test public void testWriteExternalThrowsNullPointerException() throws Throwable { ObjectOutput out = new ObjectOutputStream(new ByteArrayOutputStream()); try { new ISOField(100).writeExternal(out); fail("Expected NullPointerException to be thrown"); } catch (NullPointerException ex) { if (isJavaVersionAtMost(JAVA_14)) { assertNull(ex.getMessage(), "ex.getMessage()"); } else { assertEquals("Cannot invoke \"String.length()\" because \"s\" is null", ex.getMessage(), "ex.getMessage()"); } } }
@Test public void testWriteExternalThrowsNullPointerException1() throws Throwable { try { new ISOField(100).writeExternal(null); fail("Expected NullPointerException to be thrown"); } catch (NullPointerException ex) { if (isJavaVersionAtMost(JAVA_14)) { assertNull(ex.getMessage(), "ex.getMessage()"); } else { assertEquals("Cannot invoke \"java.io.ObjectOutput.writeShort(int)\" because \"out\" is null", ex.getMessage(), "ex.getMessage()"); } } }