User extends BaseEntity { public void setRoles(String[] roles) { this.roles = roles; } protected  User();  User(String firstName, String lastName, String username, String password, String[] roles); String getFirstName(); void setFirstName(String firstName); String getLastName(); void setLastName(String lastName); String getUsername(); void setUsername(String username); String getPassword(); void setPassword(String password); String[] getRoles(); void setRoles(String[] roles); List<Book> getWishList(); void addBookToWishList(Book book); void removeBookFromWishList(Book book); Cart getCart(); void addBookToCart(Book book); void removeBookFromCart(Book book); List<Order> getOrders(); static final PasswordEncoder PASSWORD_ENCODER; }
@Test public void setRoles() throws Exception { user.setRoles(new String[] {"ROLE_USER", "ROLE_ADMIN"}); admin.setRoles(new String[] {"ROLE_USER"}); assertArrayEquals(new String[] {"ROLE_USER"}, admin.getRoles()); assertArrayEquals(new String[] {"ROLE_USER", "ROLE_ADMIN"}, user.getRoles()); }