0

Here I am using whenNew method in powermockito.

@Test
     public void test() {
        MsgTransmit msgtransmit= mockm(MsgTransmit.class); 
        String userId= id101;     
        Powermockito.whennew(msgtransmit .class).withArgumen("transmit.get_msg",jdbcTemplate).thenReturn(MsgTransmit); 
        Powermockito.when(msgtransmit.res(msg,userId).thenReturn(output);
        Msg.getDetails(userId,msg); 
    }

Powermockito.whenNew(msgtransmit .class).withAnyArguments().thenReturn(null);

How to change whenNew to testng.Can anyone provide some example for this conversion. And recommend some websites for learning testng.

  • To learn testng: https://testng.org/doc/ https://www.tutorialspoint.com/testng/ https://www.guru99.com/all-about-testng-and-selenium.html To convert the whenNew method in PowerMockito to TestNG, you can use the @Mock and then jusr stub with when() when(msgTransmit.res(msg, userId)).thenReturn(output); – Feel free May 22 '23 at 11:45
  • Can u show one example of changing whenNew to testng code – Keerthi Senthil May 23 '23 at 05:34

0 Answers0