/**
   * Positive test: Ensure that the unmarschalled Objects are of correct type
   *
   * <p>In order to allow For all (as far as this can be checked with generic methods)
   *
   * @throws Exception
   */
  @Test
  public void test_MarshallUnmarshall_StringBuffer_checkObjectTypes() throws Exception {
    // instantiate marshaller
    Marshaller m = PersoSimJaxbContextProvider.getContext().createMarshaller();
    m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);

    // Marshall/unmarshall through StringBuffer
    StringWriter strWriter = new StringWriter();
    m.marshal(testPerso, strWriter);
    StringReader sr = new StringReader(strWriter.toString());
    Unmarshaller um = PersoSimJaxbContextProvider.getContext().createUnmarshaller();
    XmlPersonalization unmarshalledPerso = (XmlPersonalization) um.unmarshal(sr);

    // check all CardObjects, their children and all Identifiers of the card objet tree
    assertObjectTypes(unmarshalledPerso.getObjectTree());
  }
  @Before
  public void setUp() throws Exception {
    // build/fill test perso

    testPerso = new XmlPersonalization();
    List<Protocol> protocolList = testPerso.getProtocolList();
    protocolList.add(new FileProtocol());
    protocolList.add(new PaceProtocol());
    protocolList.add(new TaProtocol());
    protocolList.add(new CaProtocol());

    MasterFile mf = testPerso.getMf();
    mf.addChild(
        new ElementaryFile(
            new FileIdentifier(0x1C),
            null,
            new byte[] {},
            Collections.<SecCondition>emptySet(),
            Collections.<SecCondition>emptySet(),
            Collections.<SecCondition>emptySet()));
  }