lundi 6 janvier 2020

spring boot unit testing assertionError

In my spring boot application, to signin a user I use LoginCredentialDTO and when using post I send the following json in http://localhost:8080/signin

{
    "username":"1",
    "passwordHash":"1"
}

then it calls a method called signin to save. Now here is the problem it saves LoginCredential not the DTO and LoginCredential has one to one mapping of User.

Now the problem is in Unit Testing :

@Test
    public void signinTest() {
        LoginCredentialDTO lcDTO=new LoginCredentialDTO();
        lcDTO.setUsername("1");
        lcDTO.setPasswordHash("1");
        //assertEquals(lcDTO, loginCredentialService.signin(lcDTO));
    }

I tried this, and success? unit testing done?

And when I uncomment the line it gives me error. why is that?

Aucun commentaire:

Enregistrer un commentaire