Package org.milyn.scribe.invoker

Examples of org.milyn.scribe.invoker.AnnotatedDaoInvoker


  AnnotatedDaoRuntimeInfo minimumDaoRuntimeInfo = runtimeInfoFactory.create(MinimumAnnotatedDao.class);

  public void test_insert_with_entity_return() {

    DaoInvoker invoker = new AnnotatedDaoInvoker(fullDao, fullDaoRuntimeInfo);

    Object toPersist = new Object();

    Object expectedResult = new Object();

    when(fullDao.insertIt(toPersist)).thenReturn(expectedResult);

    Object result = invoker.insert(toPersist);

    verify(fullDao).insertIt(same(toPersist));

    assertSame(expectedResult, result);
  }
View Full Code Here


    assertSame(expectedResult, result);
  }

  public void test_insert_with_null_return() {

    DaoInvoker invoker = new AnnotatedDaoInvoker(fullDao, fullDaoRuntimeInfo);

    Object toPersist = new Object();

    when(fullDao.insertIt(toPersist)).thenReturn(null);

    Object result = invoker.insert(toPersist);

    verify(fullDao).insertIt(same(toPersist));

    assertNull(result);
  }
View Full Code Here

    assertNull(result);
  }

  public void test_insert_with_named_method() {

    DaoInvoker invoker = new AnnotatedDaoInvoker(fullDao, fullDaoRuntimeInfo);

    Object toPersist = new Object();

    invoker.insert("insertIt", toPersist);
    invoker.insert("insertIt2", toPersist);
    invoker.insert("insertIt3", toPersist);

    verify(fullDao).insertIt(same(toPersist));
    verify(fullDao).insertIt2(same(toPersist));
    verify(fullDao).insertItDiff(same(toPersist));
  }
View Full Code Here

    verify(fullDao).insertItDiff(same(toPersist));
  }

  public void test_insert_noEntityReturned() {

    DaoInvoker invoker = new AnnotatedDaoInvoker(daoNoEntityReturned, daoNoEntityReturnedRuntimeInfo);

    Object toPersist = new Object();

    when(daoNoEntityReturned.persistIt(toPersist)).thenReturn(toPersist);

    Object result = invoker.insert(toPersist);

    verify(daoNoEntityReturned).persistIt(same(toPersist));

    assertNull(result);
  }
View Full Code Here

  }

  @Test(groups = "unit", expectedExceptions = NoMethodWithAnnotationFoundException.class)
  public void test_insert_no_annotation() {

    DaoInvoker invoker = new AnnotatedDaoInvoker(minimumDao, minimumDaoRuntimeInfo);

    Object toPersist = new Object();

    invoker.insert(toPersist);


  }
View Full Code Here

  }

  public void test_update_with_entity_return() {


    DaoInvoker invoker = new AnnotatedDaoInvoker(fullDao, fullDaoRuntimeInfo);

    Object toUpdate = new Object();

    Object expectedResult = new Object();

    when(fullDao.updateIt(toUpdate)).thenReturn(expectedResult);

    Object result = invoker.update(toUpdate);

    verify(fullDao).updateIt(same(toUpdate));

    assertSame(expectedResult, result);
View Full Code Here

  }

  public void test_update_with_null_return() {

    DaoInvoker invoker = new AnnotatedDaoInvoker(fullDao, fullDaoRuntimeInfo);

    Object toUpdate = new Object();

    when(fullDao.updateIt(toUpdate)).thenReturn(null);

    Object result = invoker.update(toUpdate);

    verify(fullDao).updateIt(same(toUpdate));

    assertNull(result);
  }
View Full Code Here

    assertNull(result);
  }

  public void test_update_with_named_method() {

    DaoInvoker invoker = new AnnotatedDaoInvoker(fullDao, fullDaoRuntimeInfo);

    Object toUpdate = new Object();

    invoker.update("updateIt", toUpdate);
    invoker.update("updateIt2", toUpdate);
    invoker.update("updateIt3", toUpdate);

    verify(fullDao).updateIt(same(toUpdate));
    verify(fullDao).updateIt2(same(toUpdate));
    verify(fullDao).updateItDiff(same(toUpdate));
  }
View Full Code Here

  @Test(groups = "unit", expectedExceptions = NoMethodWithAnnotationFoundException.class)
  public void test_update_no_annotation() {


    DaoInvoker invoker = new AnnotatedDaoInvoker(minimumDao, minimumDaoRuntimeInfo);

    Object toMerge = new Object();

    invoker.update(toMerge);

  }
View Full Code Here

  }

  public void test_update_noEntityReturned() {

    DaoInvoker invoker = new AnnotatedDaoInvoker(daoNoEntityReturned, daoNoEntityReturnedRuntimeInfo);

    Object toDelete = new Object();

    when(daoNoEntityReturned.deleteIt(toDelete)).thenReturn(toDelete);

    Object result = invoker.delete(toDelete);

    verify(daoNoEntityReturned).deleteIt(same(toDelete));

    assertNull(result);
  }
View Full Code Here

TOP

Related Classes of org.milyn.scribe.invoker.AnnotatedDaoInvoker

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.