### Question:
BranchFieldPackager extends AFSDFieldPackager { @Override public int unpack(byte[] inStream, int offset, Map<String, String> fields) throws ISOException { String fieldValue = fields.get(switchField); if (fieldValue == null) { if (defaultCase != null) { offset = defaultCase.unpack(inStream, offset, fields); fields.put(defaultCase.getName(), defaultCase.getValue()); } } else { AFSDFieldPackager temp = switchCases.get(fieldValue); if (temp == null) { if (defaultCase != null) { offset = defaultCase.unpack(inStream, offset, fields); fields.put(defaultCase.getName(), defaultCase.getValue()); } } else { offset = temp.unpack(inStream, offset, fields); fields.put(temp.getName(), temp.getValue()); } } return offset; } BranchFieldPackager(String name, String switchField, Map<String, AFSDFieldPackager> switchCases,
			AFSDFieldPackager defaultCase); @Override int unpack(byte[] inStream, int offset, Map<String, String> fields); @Override byte[] pack(Map<String, String> fields); @Override String getValue(); @Override void setValue(String value); @Override String dump(String prefix, Map<String, String> setfields); @Override String getParserTree(String prefix);  }### Answer:
@Test public void unpacktest07() throws ISOException{ AFSDFieldPackager f1 = new FixedFieldPackager("F1", 5, AsciiInterpreter.INSTANCE); AFSDFieldPackager f2 = new FixedFieldPackager("F2", 2, AsciiInterpreter.INSTANCE); AFSDFieldPackager case01 = new FixedFieldPackager("F4", 3, AsciiInterpreter.INSTANCE); AFSDFieldPackager case02 = new FixedFieldPackager("F5", 4, AsciiInterpreter.INSTANCE); Map<String, AFSDFieldPackager> caseMap = new HashMap<String, AFSDFieldPackager>(); caseMap.put("01", case01); caseMap.put("02", case02); AFSDFieldPackager f3 = new BranchFieldPackager("F3", "F2", caseMap, null); FSDMsgX msg = new FSDMsgX("Test"); msg.add("F1", f1); msg.add("F2", f2); msg.add("F3", f3); String raw = "12345" + "02" + "0000"; msg.unpack(raw.getBytes()); }