lundi 21 septembre 2020

Testing in Spring Boot

public static String getStatusCode(MsgType response){
        if(Objects.isNull(response.getMsgData().getInformationType().getDataRsType())){
            return response.getRespCode();
        }
        else{
            return response.getMsgData().getInformationType().getDataRsType(.getContractRsType().getInfoType().getInfoStatusType().getStatusCode();
        }
    }

I need for help in test of this method

@Test
void getStatusCodeTest(){
    MsgType msgTypeMock = mock(MsgType.class);
    
    PowerMockito.mockStatic(TransferUtils.class);
    
    PowerMockito.when()TransferUtils.getStatusCode(MsgTypeMock)).thenReturn(null);
}

Please help to complete this block and test if it returns as supposed

Aucun commentaire:

Enregistrer un commentaire