Package st.gravel.support.compiler.testtools

Examples of st.gravel.support.compiler.testtools.ClassBuilder


  @Test
  public void testArrayCollect() throws InstantiationException,
      IllegalAccessException, IllegalArgumentException,
      InvocationTargetException, NoSuchMethodException, SecurityException {

    Class stClass = new ClassBuilder("FooObject_testArrayAdd")
        .method("foo | coll |" +
            "  ^#(1 2 3) collect: [:each | each + 4]")
        .build();

    Object fooObject = stClass.newInstance();
View Full Code Here


  @Test
  public void testOrderedCollectionAdd() throws InstantiationException,
      IllegalAccessException, IllegalArgumentException,
      InvocationTargetException, NoSuchMethodException, SecurityException {

    Class stClass = new ClassBuilder("FooObject_testOrderedCollectionAdd")
        .method("foo | coll |" +
            "  coll := OrderedCollection new." +
            "  coll add: 1." +
            "  coll add: 'Fromage'." +
            "  coll add: 2." +
View Full Code Here

  @Test
  public void testOrderedCollectionRemoveFirst() throws InstantiationException,
      IllegalAccessException, IllegalArgumentException,
      InvocationTargetException, NoSuchMethodException, SecurityException {

    Class stClass = new ClassBuilder("FooObject_testOrderedCollectionRemoveFirst")
        .method("foo | coll |" +
            "  coll := OrderedCollection new." +
            "  coll add: 1." +
            "  coll add: 'Fromage'." +
            "  coll add: 2."
View Full Code Here

  @Test
  public void testSetAdd() throws InstantiationException,
      IllegalAccessException, IllegalArgumentException,
      InvocationTargetException, NoSuchMethodException, SecurityException {

    Class stClass = new ClassBuilder("FooObject_testSetAdd")
        .method("foo | set |" +
            "  set := Set new." +
            "  set add: 1." +
            "  set add: 'Fromage'." +
            "  set add: 2." +
View Full Code Here

  @Test
  public void testSetCollect() throws InstantiationException,
      IllegalAccessException, IllegalArgumentException,
      InvocationTargetException, NoSuchMethodException, SecurityException {

    Class stClass = new ClassBuilder("FooObject_testSetCollect")
        .method("foo | set |" +
            "  set := Set new." +
            "  set add: 1." +
            "  set add: 2." +
            "  set add: 3." +
View Full Code Here

  @Before
  public void setUp() {
    TestBootstrap.getSingleton();
    if (testExceptionAClass == null) {
      testExceptionAClass = new ClassBuilder("TestExceptionA")
          .superclassName("st.gravel.lang.Exception")
          .method("testValue ^7").build();
    }
    if (testExceptionBClass == null) {
      testExceptionBClass = new ClassBuilder("TestExceptionB")
          .superclassName("st.gravel.lang.Exception")
          .method("testValue ^11").build();
    }
  }
View Full Code Here

  public void test_on_do_() throws NoSuchMethodException, SecurityException,
      IllegalAccessException, IllegalArgumentException,
      InvocationTargetException, InstantiationException {


    Class stClass = new ClassBuilder("FooObject_test_on_do_").instVar("bar")
        .method("foo" + "  ^self foo: [TestExceptionA raise. bar := #failed]")
        .method("isFailed ^bar notNil")
        .method("foo: aBlock  "
            + "^[aBlock value] on: TestExceptionA do: [:ex | ex testValue]")
        .build();
View Full Code Here

  public void testNested_on_do_1() throws NoSuchMethodException, SecurityException,
      IllegalAccessException, IllegalArgumentException,
      InvocationTargetException, InstantiationException {


    Class stClass = new ClassBuilder("FooObject_testNested_on_do_1").instVar("bar")
        .method("foo" + "  ^self foo: [TestExceptionA raise. bar := #failed]")
        .method("isFailed ^bar notNil")
        .method("foo: aBlock  "
            + "^[[aBlock value] on: TestExceptionA do: [:ex1 | ex1 testValue]] on: TestExceptionB do: [:ex | ex testValue]")
        .build();
View Full Code Here

  @Test
  public void testPrintInt() throws InstantiationException,
      IllegalAccessException, IllegalArgumentException,
      InvocationTargetException, NoSuchMethodException, SecurityException {

    Class stClass = new ClassBuilder("FooObject_testPrintInt").method("foo ^7 printString")
        .build();

    Object fooObject = stClass.newInstance();
    Method method = fooObject.getClass().getMethod("foo");
    Object result = method.invoke(fooObject);
View Full Code Here

  @Test
  public void testReturnInt() throws InstantiationException,
      IllegalAccessException, IllegalArgumentException,
      InvocationTargetException, NoSuchMethodException, SecurityException {

    Class stClass = new ClassBuilder("FooObject_testReturnInt").method("foo ^1")
        .build();

    Object fooObject = stClass.newInstance();
    Method method = fooObject.getClass().getMethod("foo");
    Object result = method.invoke(fooObject);
View Full Code Here

TOP

Related Classes of st.gravel.support.compiler.testtools.ClassBuilder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.