コード例 #1
0
ファイル: Extension_Test.java プロジェクト: wolfhesse/MPS
 public void tearDown() {
   Assert.assertFalse(TEST_OBJECT.getShutDown());
   ApplicationManagerEx.getApplicationEx()
       .addApplicationListener(
           new ApplicationAdapter() {
             @Override
             public void applicationExiting() {
               if (!(Extension_Test.TEST_OBJECT.getShutDown())) {
                 throw new RuntimeException("!TestObject.shutDown");
               }
             }
           });
 }
コード例 #2
0
ファイル: Extension_Test.java プロジェクト: wolfhesse/MPS
 @MPSLaunch
 public void test_testObject() throws Exception {
   Iterable<Extension<TestObject>> extensions =
       ((ExtensionPoint<TestObject>)
               ExtensionPoint.<TestObject>generify(
                   new ExtensionPoint(
                       "jetbrains.mps.lang.extension.tests.testExtensionPoint", TestObject.class)))
           .getExtensions();
   Assert.assertNotNull(extensions);
   Iterator<Extension<TestObject>> it = extensions.iterator();
   Assert.assertTrue(it.hasNext());
   Extension<TestObject> ext = it.next();
   try {
     it.next();
     Assert.fail("unexpected value");
   } catch (NoSuchElementException e) {
     // expected exception
   }
   TestObject to = ext.get();
   TEST_OBJECT = to;
   Assert.assertEquals("foobar", to.getValue());
   Assert.assertFalse(to.getShutDown());
 }