### Question:
CellId implements NodeProtoId, Serializable { public ExportId newPortId(String externalId) { return newExportId(externalId, true); } CellId(LibId libId, CellName cellName, int cellIndex); IdManager getIdManager(); int numUsagesIn(); CellUsage getUsageIn(int i); int numUsagesOf(); CellUsage getUsageOf(int i); CellUsage getUsageIn(CellId protoId); int numExportIds(); ExportId getPortId(int chronIndex); ExportId newPortId(String externalId); ExportId randomExportId(String suggestedId); int newNodeId(); int newArcId(); Cell inDatabase(EDatabase database); String toString(); boolean isIcon(); boolean isSchematic(); static void main(String[] args); static final CellId[] NULL_ARRAY; final IdManager idManager; final LibId libId; final CellName cellName; final int cellIndex; }### Answer:
@Test public void testNewPortId() { System.out.println("newPortId"); String name = nameA; CellId instance = cellId1; assertEquals(1, instance.numExportIds()); ExportId expResult = e1_A; ExportId result = instance.newPortId(name); assertSame(expResult, result); assertEquals(1, instance.numExportIds()); String nameB = "B"; ExportId idB = instance.newPortId(nameB); assertSame(instance, idB.parentId); assertEquals(1, idB.chronIndex); assertSame(nameB, idB.externalId); assertEquals(2, cellId1.numExportIds()); idManager.checkInvariants(); }
@Test(expected = NullPointerException.class) public void testNewPortIdNull() { System.out.println("newPortId null"); cellId0.newPortId(null); }