Package chapter02.s05

Examples of chapter02.s05.Vehicle


        assertTrue("dynamic property".equals(obj.getProperty("x")));
        assertTrue(obj.getMetaClass().getAttribute(obj, "x") == newX3);
    }

    public void testMetaClassNameHandling1() {
        final Tt1gi obj = new Tt1gi() {
        }; // repeat test with subclass
        final String newX = "new x";
        final String newX1 = "new x1";
        final String newX2 = "new x2";
        final String newX3 = "new x3";

        assertTrue("dynamic property".equals(obj.getProperty("x")));
        assertTrue(obj.getMetaClass().getAttribute(obj, "x") == obj.x);
        assertTrue("dynamic method".equals(obj.invokeMethod("x", new Object[]{})));

        obj.setProperty("x", newX);
        obj.getMetaClass().setAttribute(obj, "x", newX1);

        assertTrue("dynamic property".equals(obj.getProperty("x")));
        assertTrue(obj.getMetaClass().getAttribute(obj, "x") == newX1);

        obj.setX(newX2);
        obj.x = newX3;

        assertTrue("dynamic property".equals(obj.getProperty("x")));
        assertTrue(obj.getMetaClass().getAttribute(obj, "x") == newX3);
    }
View Full Code Here


* @author John Wilson
*/

public class JName1Test extends TestCase {
    public void testObjectSupportNameHandling() {
        final Tt1go obj = new Tt1go()// Test subclass of GroovyObjectSupport
        final String newX = "new x";
        final String newX1 = "new x1";
        final String newX2 = "new x2";
        final String newX3 = "new x3";

        assertTrue(obj.getProperty("x") == obj.getX());
        assertTrue(obj.getMetaClass().getAttribute(obj, "x") == obj.x);
        assertTrue(obj.invokeMethod("x", new Object[]{}) == obj.x());

        obj.setProperty("x", newX);
        obj.getMetaClass().setAttribute(obj, "x", newX1);

        assertTrue(obj.getProperty("x") == newX);
        assertTrue(obj.getMetaClass().getAttribute(obj, "x") == newX1);

        obj.setX(newX2);
        obj.x = newX3;

        assertTrue(obj.getProperty("x") == newX2);
        assertTrue(obj.getMetaClass().getAttribute(obj, "x") == newX3);
    }
View Full Code Here

        assertTrue(obj.getProperty("x") == newX2);
        assertTrue(obj.getMetaClass().getAttribute(obj, "x") == newX3);
    }

    public void testObjectSupportNameHandling1() {
        final Tt1go obj = new Tt1go() {
        }; // repeat test with subclass
        final String newX = "new x";
        final String newX1 = "new x1";
        final String newX2 = "new x2";
        final String newX3 = "new x3";

        assertTrue(obj.getProperty("x") == obj.getX());
        assertTrue(obj.getMetaClass().getAttribute(obj, "x") == obj.x);
        assertTrue(obj.invokeMethod("x", new Object[]{}) == obj.x());

        obj.setProperty("x", newX);
        obj.getMetaClass().setAttribute(obj, "x", newX1);

        assertTrue(obj.getProperty("x") == newX);
        assertTrue(obj.getMetaClass().getAttribute(obj, "x") == newX1);

        obj.setX(newX2);
        obj.x = newX3;

        assertTrue(obj.getProperty("x") == newX2);
        assertTrue(obj.getMetaClass().getAttribute(obj, "x") == newX3);
    }
View Full Code Here

  // ======================================

  @Test
  public void shouldCheckNumberIsThirteenDigits() {
    BookService06 bookService = container.instance().select(BookService06.class).get();
    Book06 book = bookService.createBook("H2G2", 12.5f, "Geeky scifi Book");
    assertTrue(book.getIsbn().startsWith("13"));
  }
View Full Code Here

  // =              Methods               =
  // ======================================

  @Test
  public void shouldCheckNumberIsThirteenDigits() {
    BookService06 bookService = container.instance().select(BookService06.class).get();
    Book06 book = bookService.createBook("H2G2", 12.5f, "Geeky scifi Book");
    assertTrue(book.getIsbn().startsWith("13"));
  }
View Full Code Here

  // ======================================

  @Test
  public void shouldCheckNumberIsThirteenDigits() {
    BookService07 bookService = container.instance().select(BookService07.class).get();
    Book07 book = bookService.createBook("H2G2", 12.5f, "Geeky scifi Book");
    assertTrue(book.getIsbn().startsWith("13"));
  }
View Full Code Here

  }

  @Test
  public void shouldCheckNumberIsEightDigits() {
    LegacyBookService07 bookService = container.instance().select(LegacyBookService07.class).get();
    Book07 book = bookService.createBook("H2G2", 12.5f, "Geeky scifi Book");
    assertTrue(book.getIsbn().startsWith("8"));
  }
View Full Code Here

  // =              Methods               =
  // ======================================

  @Test
  public void shouldCheckNumberIsThirteenDigits() {
    BookService07 bookService = container.instance().select(BookService07.class).get();
    Book07 book = bookService.createBook("H2G2", 12.5f, "Geeky scifi Book");
    assertTrue(book.getIsbn().startsWith("13"));
  }
View Full Code Here

  // ======================================

  @Test
  public void shouldCheckNumberIsThirteenDigitsOdd() {
    BookOddService10 bookService = container.instance().select(BookOddService10.class).get();
    Book10 book = bookService.createBook("H2G2", 12.5f, "Geeky scifi Book");
    assertTrue(book.getIsbn().startsWith("131"));
  }
View Full Code Here

  }

  @Test
  public void shouldCheckNumberIsThirteenDigitsEven() {
    BookEvenService10 bookService = container.instance().select(BookEvenService10.class).get();
    Book10 book = bookService.createBook("H2G2", 12.5f, "Geeky scifi Book");
    assertTrue(book.getIsbn().startsWith("132"));
  }
View Full Code Here

TOP

Related Classes of chapter02.s05.Vehicle

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.