Examples of AnnotatedDaoInvoker


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

Examples of org.milyn.scribe.invoker.AnnotatedDaoInvoker

    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

Examples of org.milyn.scribe.invoker.AnnotatedDaoInvoker

    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

Examples of org.milyn.scribe.invoker.AnnotatedDaoInvoker

    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

Examples of org.milyn.scribe.invoker.AnnotatedDaoInvoker

  }

  @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

Examples of org.milyn.scribe.invoker.AnnotatedDaoInvoker

  }

  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

Examples of org.milyn.scribe.invoker.AnnotatedDaoInvoker

  }

  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

Examples of org.milyn.scribe.invoker.AnnotatedDaoInvoker

    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

Examples of org.milyn.scribe.invoker.AnnotatedDaoInvoker

  @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

Examples of org.milyn.scribe.invoker.AnnotatedDaoInvoker

  }

  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
Copyright © 2018 www.massapi.com. 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.