Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor AccountControllerTest #3

Open
rickybustillos opened this issue Nov 8, 2021 · 1 comment
Open

Refactor AccountControllerTest #3

rickybustillos opened this issue Nov 8, 2021 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@rickybustillos
Copy link
Member

rickybustillos commented Nov 8, 2021

Old AccountController.create()
adc7241#diff-b576dad9d2beffbe7963007dfed60c1e5e4fe7125b41dac8310d8ddf28bd7859

Old AccountControllerTest
adc7241#diff-44417e048b8ed9cce7166e64136a1fc8e813fb67c95b6fa97802c1e551bd60d3

Updated AccountController.create()
5089341#diff-b576dad9d2beffbe7963007dfed60c1e5e4fe7125b41dac8310d8ddf28bd7859

    // todo: refactor this test
    @isTest
    public static void givenRequestAccountWhenPostToServerThenCreateAnAccount() {

        Account account = AccountController.create(AccountFixtureFactory.newAccount());

        System.assert(account.Id != null);
    }
@rickybustillos rickybustillos added the bug Something isn't working label Nov 8, 2021
@rickybustillos rickybustillos self-assigned this Nov 8, 2021
@rickybustillos
Copy link
Member Author

In class, the method's return is changed to void. But to carry out the test it is necessary to return the response to validate, for example, the response status code. The question is: Is it a good practice to put a return in @HttpPost method? Or is there another better way to do this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant