connell-class / revassess

this is a trial repo for making a template for the revature assessment
2 stars 11 forks source link

tier4/test4: Role enum assertion off by 1 #23

Closed flacks closed 4 years ago

flacks commented 4 years ago

Describe the bug If we go by the ordering of the dummy data, we have:

INSERT INTO user_role VALUES (0, 'ADMIN');
INSERT INTO user_role VALUES (0, 'DEV');
INSERT INTO user_role VALUES (0, 'BASIC_USER');
INSERT INTO user_role VALUES (0, 'PREMIUM_USER');
INSERT INTO user_role VALUES (0, 'LOCKED');

Since enums are 0-indexed, at line 22 of Answer4Tests.java: assertEquals(String.valueOf(Role.class .getEnumConstants()[3]), "BASIC_USER"); we are actually expecting "PREMIUM_USER"

Workaround Set index value of getEnumConstants()[] to 2