### Question:
ImmutableCell extends ImmutableElectricObject { public ImmutableCell withGroupName(CellName groupName) { if (this.groupName.equals(groupName)) { return this; } if (groupName.getVersion() != 0 || groupName.getView() != View.SCHEMATIC) { throw new IllegalArgumentException(groupName.toString()); } return new ImmutableCell(this.cellId, groupName, this.creationDate, this.revisionDate, this.techId, this.flags, getVars(), this.params); } private  ImmutableCell(CellId cellId, CellName groupName,
            long creationDate, long revisionDate, TechId techId, int flags, Variable[] vars, Variable[] params); static ImmutableCell newInstance(CellId cellId, long creationDate); ImmutableCell withGroupName(CellName groupName); ImmutableCell withCreationDate(long creationDate); ImmutableCell withRevisionDate(long revisionDate); ImmutableCell withTechId(TechId techId); ImmutableCell withFlags(int flags); Variable getParameter(Variable.AttrKey key); Iterator<Variable> getParameters(); int getNumParameters(); Variable getParameter(int paramIndex); ImmutableCell withParam(Variable var); ImmutableCell withoutParam(Variable.AttrKey key); ImmutableCell withVariable(Variable var); ImmutableCell withoutVariable(Variable.Key key); ImmutableCell withoutVariables(); LibId getLibId(); int hashCodeExceptVariables(); boolean equalsExceptVariables(ImmutableElectricObject o); void check(); boolean paramsAllowed(); boolean busNamesAllowed(); @Override String toString(); final CellId cellId; final CellName groupName; final long creationDate; final long revisionDate; final TechId techId; }### Answer:
@Test public void testWithGroupName() { System.out.println("withGroupName"); assertSame(d, d.withGroupName(CellName.parseName("foo{sch}"))); CellName groupName = CellName.parseName("bar{sch}"); ImmutableCell d1 = d.withGroupName(groupName); d1.check(); assertSame(d.cellId, d1.cellId); assertSame(groupName, d1.groupName); assertEquals(d.creationDate, d1.creationDate); assertSame(d.techId, d1.techId); assertSame(d.getVars(), d1.getVars()); assertEquals(d.flags, d1.flags); }
@Test(expected = NullPointerException.class) public void testWithGroupNameNull() { System.out.println("withGroupNameNull"); d.withGroupName(CellName.parseName(null)); }
@Test(expected = IllegalArgumentException.class) public void testWithGroupNameBad() { System.out.println("withGroupNameBad"); d.withGroupName(CellName.parseName("foo{ic}")); }