Package dom.simple

Examples of dom.simple.SimpleObject


           
            @Override
            public Object invoke(Invocation invocation) throws Throwable {
                final InMemoryDB inMemoryDB = getVar("isis", "in-memory-db", InMemoryDB.class);
                final String name = (String)invocation.getParameter(0);
                final SimpleObject obj = new SimpleObject();
                obj.setName(name);
                inMemoryDB.put(SimpleObject.class, name, obj);
                return obj;
            }
           
            @Override
View Full Code Here


     * Hook to initialize if possible.
     */
    @Override
    protected void init(Object obj, String str) {
        if(obj instanceof SimpleObject) {
            SimpleObject toDoItem = (SimpleObject) obj;
            toDoItem.setName(str);
        }
    }
View Full Code Here

    public void listAll() throws Exception {

        final List<SimpleObject> all = wrap(simpleObjects).listAll();
        assertThat(all.size(), is(3));
       
        SimpleObject simpleObject = wrap(all.get(0));
        assertThat(simpleObject.getName(), is("Foo"));
    }
View Full Code Here

    public void listAll() throws Exception {

        final List<SimpleObject> all = wrap(simpleObjects).listAll();
        assertThat(all.size(), is(3));
       
        SimpleObject simpleObject = wrap(all.get(0));
        assertThat(simpleObject.getName(), is("Foo"));
    }
View Full Code Here

   
    @Test
    public void happyCase() throws Exception {
       
        // given
        final SimpleObject simpleObject = new SimpleObject();
       
        final Sequence seq = context.sequence("create");
        context.checking(new Expectations() {
            {
                oneOf(mockContainer).newTransientInstance(SimpleObject.class);
                inSequence(seq);
                will(returnValue(simpleObject));
               
                oneOf(mockContainer).persistIfNotAlready(simpleObject);
                inSequence(seq);
            }
        });
       
        // when
        final SimpleObject obj = simpleObjects.create("Foobar");
       
        // then
        assertThat(obj, is(simpleObject));
        assertThat(obj.getName(), is("Foobar"));
    }
View Full Code Here

     * Hook to initialize if possible.
     */
    @Override
    protected void init(Object obj, String str) {
        if(obj instanceof SimpleObject) {
            SimpleObject toDoItem = (SimpleObject) obj;
            toDoItem.setName(str);
        }
    }
View Full Code Here

           
            @Override
            public Object invoke(Invocation invocation) throws Throwable {
                final InMemoryDB inMemoryDB = getVar("isis", "in-memory-db", InMemoryDB.class);
                final String name = (String)invocation.getParameter(0);
                final SimpleObject obj = new SimpleObject();
                obj.setName(name);
                inMemoryDB.put(SimpleObject.class, name, obj);
                return obj;
            }
           
            @Override
View Full Code Here

    public void listAll() throws Exception {

        final List<SimpleObject> all = simpleObjects.listAll();
        assertThat(all.size(), is(3));
       
        SimpleObject simpleObject = wrap(all.get(0));
        assertThat(simpleObject.getName(), is("Foo"));
    }
View Full Code Here

    private SimpleObject simpleObject;

    @Before
    public void setUp() throws Exception {
        simpleObject = new SimpleObject();
    }
View Full Code Here

   
    @Test
    public void happyCase() throws Exception {
       
        // given
        final SimpleObject simpleObject = new SimpleObject();
       
        final Sequence seq = context.sequence("create");
        context.checking(new Expectations() {
            {
                oneOf(mockContainer).newTransientInstance(SimpleObject.class);
                inSequence(seq);
                will(returnValue(simpleObject));
               
                oneOf(mockContainer).persistIfNotAlready(simpleObject);
                inSequence(seq);
            }
        });
       
        // when
        final SimpleObject obj = simpleObjects.create("Foobar");
       
        // then
        assertThat(obj, is(simpleObject));
        assertThat(obj.getName(), is("Foobar"));
    }
View Full Code Here

TOP

Related Classes of dom.simple.SimpleObject

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.