Пример #1
0
  @Test
  public void testEmp_AddClient() 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);
    PowerMockito.when(mocknew.addClient(mockAddCleint)).thenReturn(addEmps);

    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.getAdd();
    emp_AddClient_Action.getAdds();
    emp_AddClient_Action.getAddb();
    emp_AddClient_Action.getEdit();
    emp_AddClient_Action.getXyz();

    String addEmp = emp_AddClient_Action.addClient();

    Assert.assertEquals(addEmp, "success");
    PowerMockito.verifyNew(Emp_AddClient_DaoImpl.class);
  }
Пример #2
0
  /** @return Employee Add Clients */
  public String addClient() {

    xyz.addClient(add);
    return SUCCESS;
  }