Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package org.nakedobjects.plugins.xml.profilestore;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 
 import java.util.List;
import  org.jmock.Mockery;
import  org.jmock.integration.junit4.JUnit4Mockery;
    @Test
    public void testParsing() throws Exception {
        Mockery mockery = new JUnit4Mockery();
        ArrayList<ObjectservicesList = new ArrayList<Object>();
        TestServiceObject1 service = new TestServiceObject1();
        servicesList.add(service);
        NakedObjectSessionFactory executionContextFactory = 
            new NakedObjectSessionFactoryDefault(
                    .
                    new PropertiesConfiguration(), 
                    mockery.mock(TemplateImageLoader.class), 
                    mockery.mock(SpecificationLoader.class), 
                    mockery.mock(AuthenticationManager.class), 
                    mockery.mock(AuthorizationManager.class),
                    mockery.mock(UserProfileLoader.class), 
                    mockery.mock(PersistenceSessionFactory.class), servicesList);
          
        NakedObjectsContextStatic.createRelaxedInstance(executionContextFactory);
 
        
        
        XMLReader parser = XMLReaderFactory.createXMLReader();
        UserProfileDataHandler handler = new UserProfileDataHandler();
        parser.setContentHandler(handler);
        parser.parse(new InputSource(new InputStreamReader(new FileInputStream("test.xml"))));
        UserProfile profile = handler.getUserProfile();
        assertNotNull(profile);
        
        assertEquals(nullprofile.getOptions().value("device"));
        assertEquals("on"profile.getOptions().value("power"));
        List<Stringlist = profile.list();
        assertEquals(2, list.size());
        assertEquals("Library"list.get(0));
        assertEquals("Admin"list.get(1));
        
        assertEquals("Admin"profile.getPerspective().getName());
        assertEquals(1, profile.getPerspective().getServices().size());
        assertEquals(serviceprofile.getPerspective().getServices().get(0));
    }
// Copyright (c) Naked Objects Group Ltd.
New to GrepCode? Check out our FAQ X