@Test public void testGrantPermissionInWrongPlace() { DefaultClassLoadingPicoContainer parent = new DefaultClassLoadingPicoContainer(); try { Reader script = new StringReader( "TestHelper = org.picocontainer.script.TestHelper\n" + "SocketPermission = java.net.SocketPermission\n" + "testCompJar = TestHelper.getTestCompJarFile()\n" + "container {\n" + " grant(:perm => SocketPermission.new('google.com','connect'))\n" + "}"); buildContainer(script, parent, ASSEMBLY_SCOPE); fail("should barf with RaiseException"); } catch (PicoCompositionException e) { assertNotNull(e.getCause()); assertTrue(e.getCause() instanceof RaiseException); } }