icebreaker-science / backend

The backend (Spring Boot) part of the icebreaker.science application
Apache License 2.0
2 stars 0 forks source link

fix bug in servicestests #31

Closed michael-kamel closed 4 years ago

michael-kamel commented 4 years ago

the test getAccountProfile_idExists_success also has the same issue but it seems like it depends on other tests to function?.

The idea is that the IDs are assumed to be 1, but this is not always the case.

michael-kamel commented 4 years ago

The test suite assumes an empty database and the order is relevant for the tests to function. getAccountProfile_idExists_success() will run after an account (with ID 1) was created. But if we now have other tests that create accounts, this system is of course not going to work well.

Ideally each unit test should be isolated, but even then, sometimes postgres creates an id different than 1 even when the database is empty. I think the in-mem database might handle this well though.

chaoran-chen commented 4 years ago

okay. so feel free to merge or to add more changes to the tests if you like

michael-kamel commented 4 years ago

I might make changes to the other test as well but I am trying to figure out a way to do so with minimal impact

michael-kamel commented 4 years ago

I don't think there is an easy way to adjust the second test without altering the logic a little bit. I'm opting for keeping it this way, after all, this rarely happens anyway.