### Question:
Device { static String formatAsPhysicalAddress(Line line, String address) { if ((address == null) || (line == null) || (line.getAddress() == null) || (line.getArea() == null) || (line.getArea().getAddress() == null)) { return null; } return line.getArea().getAddress() + "." + line.getAddress() + "." + address; } Device(Line line, String id, String address, String name, String description); String getAddress(); List<CommunicationObject> getCommunicationObjects(); String getDescription(); String getId(); Line getLine(); String getName(); @Override String toString();  }### Answer:
@Test public void formatAsPhysicalAddress() throws Exception { assertNull(Device.formatAsPhysicalAddress(null, null)); assertNull(Device.formatAsPhysicalAddress(new Line(null, null, null, null, null), null)); assertNull(Device.formatAsPhysicalAddress(new Line(null, null, null, null, null), "1")); assertNull(Device.formatAsPhysicalAddress(new Line(null, null, "2", null, null), "1")); assertNull( Device.formatAsPhysicalAddress(new Line(new Area(null, null, null, null), null, "2", null, null), "1")); assertEquals("3.2.1", Device.formatAsPhysicalAddress(new Line(new Area(null, "3", null, null), null, "2", null, null), "1")); }