Exemplo n.º 1
0
  @Test
  public void testEmp_EditClient() throws Exception {

    Emp_AddClient addEmps = new Emp_AddClient();

    Emp_AddClient_DaoImpl mocknew = PowerMockito.mock(Emp_AddClient_DaoImpl.class);

    PowerMockito.whenNew(Emp_AddClient_DaoImpl.class).withNoArguments().thenReturn(mocknew);

    Emp_AddClient mockAddCleint = PowerMockito.mock(Emp_AddClient.class);
    List<Emp_AddClient> clientList = new ArrayList<Emp_AddClient>();
    PowerMockito.when(mocknew.list(mockAddCleint)).thenReturn(clientList);

    Client_Login clientlog = PowerMockito.mock(Client_Login.class);

    Emp_AddClient_Action emp_AddClient_Action = new Emp_AddClient_Action();
    emp_AddClient_Action.setAdd(mockAddCleint);
    emp_AddClient_Action.setAddb(mockAddCleint);
    emp_AddClient_Action.setAdds(clientlog);
    emp_AddClient_Action.setXyz(mocknew);
    emp_AddClient_Action.setDetail(clientList);

    // Emp_AddClient emp_AddClient = PowerMockito.mock(Emp_AddClient.class);
    emp_AddClient_Action.setEdit(mockAddCleint);
    emp_AddClient_Action.getEdit();
    emp_AddClient_Action.getDetail();

    String addEmp = emp_AddClient_Action.editclient();

    emp_AddClient_Action.eclient();

    Assert.assertEquals(addEmp, "success");
    PowerMockito.verifyNew(Emp_AddClient_DaoImpl.class);
  }
Exemplo n.º 2
0
  public String editclient() {

    this.detail = xyz.list(edit);
    return SUCCESS;
  }