Buggy code:
@ RunWith ( Arquillian . class ) public class ParseAndMarshalModelsTestCase { @ Deployment public static Archive < ? > getDeployment ( ) { } private ServiceContainer serviceContainer ; @ Before public void setupServiceContainer ( ) { } @ After public void cleanup ( ) throws Exception { } @ Test public void testStandaloneXml ( ) throws Exception { } @ Test public void testStandaloneHAXml ( ) throws Exception { } @ Test public void testStandaloneFullXml ( ) throws Exception { } @ Test public void testStandaloneFullHAXml ( ) throws Exception { } private void standaloneXmlTest ( File original ) throws Exception { } @ Test public void testHostXml ( ) throws Exception { } private void hostXmlTest ( final File original ) throws Exception { } @ Test public void testDomainXml ( ) throws Exception { } private void domainXmlTest ( File original ) throws Exception { } private void fixupOSGiStandalone ( ModelNode node1 , ModelNode node2 ) { } private void fixupOSGiDomain ( ModelNode node1 , ModelNode node2 ) { } private String convertToSingleLine ( String value ) { } private void compare ( ModelNode node1 , ModelNode node2 ) { } private ModelNode loadServerModel ( final File file ) throws Exception { <START_BUG> final ExtensionRegistry extensionRegistry = new ExtensionRegistry ( ProcessType . STANDALONE_SERVER , new org . jboss . as . controller . RunningModeControl ( RunningMode . NORMAL ) ) ; <END_BUG> final QName rootElement = new QName ( CURRENT . getUriString ( ) , "server" ) ; final StandaloneXml parser = new StandaloneXml ( Module . getBootModuleLoader ( ) , null , extensionRegistry ) ; final XmlConfigurationPersister persister = new XmlConfigurationPersister ( file , rootElement , parser , parser ) ; for ( Namespace namespace : Namespace . domainValues ( ) ) { if ( namespace != ( Namespace . CURRENT ) ) { persister . registerAdditionalRootElement ( new QName ( namespace . getUriString ( ) , "server" ) , parser ) ; } } extensionRegistry . setWriterRegistry ( persister ) ; final List < ModelNode > ops = persister . load ( ) ; final ModelNode model = new ModelNode ( ) ; final ModelController controller = createController ( STANDALONE_SERVER , model , new ParseAndMarshalModelsTestCase . Setup ( ) { public void setup ( Resource resource , ManagementResourceRegistration rootRegistration ) { ServerControllerModelUtil . updateCoreModel ( model , null ) ; ServerControllerModelUtil . initOperations ( rootRegistration , new ParseAndMarshalModelsTestCase . MockContentRepository ( ) , persister , null , null , null , null , extensionRegistry , false , new ParseAndMarshalModelsTestCase . MockFileRepository ( ) , ParseAndMarshalModelsTestCase . MOCK_PATH_MANAGER ) ; } } ) ; final ModelNode caputreModelOp = new ModelNode ( ) ; caputreModelOp . get ( OP_ADDR ) . set ( EMPTY_ADDRESS . toModelNode ( ) ) ; caputreModelOp . get ( OP ) . set ( "capture-model" ) ; final List < ModelNode > toRun = new ArrayList < ModelNode > ( ops ) ; toRun . add ( caputreModelOp ) ; executeOperations ( controller , toRun ) ; persister . store ( model , null ) . commit ( ) ; return model ; } private ModelNode loadHostModel ( final File file ) throws Exception { } private ModelNode loadDomainModel ( File file ) throws Exception { } public ModelController createController ( final ProcessType processType , final ModelNode model , final ParseAndMarshalModelsTestCase . Setup registration ) throws InterruptedException { } private void executeOperations ( ModelController controller , List < ModelNode > ops ) { } private File getOriginalStandaloneXml ( String profile ) throws FileNotFoundException { } private File getDomainConfigDir ( ) throws FileNotFoundException { } private File getHostConfigDir ( ) throws FileNotFoundException { } private File getOriginalHostXml ( final String profile ) throws FileNotFoundException { } private File getOriginalDomainXml ( final String profile ) throws FileNotFoundException { } DescriptionProvider getRootDescriptionProvider ( ) { } interface Setup { void setup ( Resource resource , ManagementResourceRegistration rootRegistration ) { } } class ModelControllerService extends AbstractControllerService { private final CountDownLatch latch = new CountDownLatch ( 1 ) ; private final ModelNode model ; private final ParseAndMarshalModelsTestCase . Setup registration ; ModelControllerService ( final ProcessType processType , final ControlledProcessState processState , final ParseAndMarshalModelsTestCase . Setup registration , final ModelNode model ) { } @ Override public void start ( StartContext context ) throws StartException { } @ Override protected void boot ( BootContext context ) throws ConfigurationPersistenceException { } protected void initModel ( Resource rootResource , ManagementResourceRegistration rootRegistration ) { } } private static class MockContentRepository implements ContentRepository { private static final ParseAndMarshalModelsTestCase . MockContentRepository INSTANCE = new ParseAndMarshalModelsTestCase . MockContentRepository ( ) ; @ Override public byte [ ] addContent ( InputStream stream ) throws IOException { } @ Override public VirtualFile getContent ( byte [ ] hash ) { } @ Override public boolean hasContent ( byte [ ] hash ) { } @ Override public void removeContent ( byte [ ] hash ) { } } private static class MockFileRepository implements HostFileRepository { private static final ParseAndMarshalModelsTestCase . MockFileRepository INSTANCE = new ParseAndMarshalModelsTestCase . MockFileRepository ( ) ; @ Override public File getFile ( String relativePath ) { } @ Override public File getConfigurationFile ( String relativePath ) { } @ Override public File [ ] getDeploymentFiles ( byte [ ] deploymentHash ) { } @ Override public File getDeploymentRoot ( byte [ ] deploymentHash ) { } @ Override public void deleteDeployment ( byte [ ] deploymentHash ) { } } private static class MockDomainController implements DomainController { public LocalHostControllerInfo getLocalHostInfo ( ) { } public void registerRemoteHost ( ProxyController hostControllerClient ) { } public boolean isHostRegistered ( String id ) { } public void unregisterRemoteHost ( String id ) { } public void registerRunningServer ( ProxyController serverControllerClient ) { } public void unregisterRunningServer ( String serverName ) { } public ModelNode getProfileOperations ( String profileName ) { } public HostFileRepository getLocalFileRepository ( ) { } public HostFileRepository getRemoteFileRepository ( ) { } public void stopLocalHost ( ) { }

Fix:
final ExtensionRegistry extensionRegistry = new ExtensionRegistry ( ProcessType . STANDALONE_SERVER , new org . jboss . as . controller . RunningModeControl ( RunningMode . ADMIN_ONLY ) ) ;