### Question:
FramedAppleTalkZoneAttribute extends Attribute { public String getZone() { return zone; } FramedAppleTalkZoneAttribute(String zone);  FramedAppleTalkZoneAttribute(byte[] octets); String getZone(); String toStringImpl();  }### Answer:
@Test public void testTruncationOfString() throws IOException { final String fifty = "---------1---------2---------3---------4---------5"; final String f253 = new StringBuilder() .append(fifty).append(fifty).append(fifty).append(fifty).append(fifty).append("123").toString(); final String f259 = new StringBuilder().append(f253).append("456789").toString(); final FramedAppleTalkZoneAttribute a = new FramedAppleTalkZoneAttribute(f259); Assert.assertEquals(a.getZone(), f253, "filter id string should have been truncated to 254 chars"); final byte[] bytes = a.getOctets(); Assert.assertEquals(bytes[0], AttributeType.FRAMED_APPLETALK_ZONE.getTypeCode()); Assert.assertEquals(bytes[1], ((byte) 255)); Assert.assertEquals(new String(bytes, 2, 253, Charset.forName("utf-8")), f253); }
@Test public void test253StringFits() throws IOException { final String fifty = "---------1---------2---------3---------4---------5"; final String f253 = new StringBuilder() .append(fifty).append(fifty).append(fifty).append(fifty).append(fifty).append("123").toString(); final FramedAppleTalkZoneAttribute a = new FramedAppleTalkZoneAttribute(f253); Assert.assertEquals(a.getZone(), f253, "253 byte filter id string should have been allowed"); final byte[] bytes = a.getOctets(); Assert.assertEquals(bytes[0], AttributeType.FRAMED_APPLETALK_ZONE.getTypeCode()); Assert.assertEquals(bytes[1], ((byte) 255)); Assert.assertEquals(new String(bytes, 2, 253, Charset.forName("utf-8")), f253); }