I have a grails controller which takes a simple string and updates a column in the DB by id. I want to write a jUnit test for this operation to make sure the update went through correctly....
@Test
void "testUpdateNameOnMonsterById"() {
controller.params.id = 8;
controller.params.name = 'Godzilla';
controller.updateMosterNameById();
// what are the different jUnit assertetions that need to happen at this point?
For example should I query the DB and do assertEquals or assertTrue?
Any sample code with jUnit asserts would be greatly appreciated.
No comments:
Post a Comment