1 | package edu.ucsb.cs156.gauchoride.services; | |
2 | ||
3 | import java.util.Collection; | |
4 | ||
5 | import org.springframework.security.core.GrantedAuthority; | |
6 | ||
7 | import edu.ucsb.cs156.gauchoride.entities.User; | |
8 | import edu.ucsb.cs156.gauchoride.models.CurrentUser; | |
9 | ||
10 | public abstract class CurrentUserService { | |
11 | public abstract User getUser(); | |
12 | public abstract CurrentUser getCurrentUser(); | |
13 | public abstract Collection<? extends GrantedAuthority> getRoles(); | |
14 | ||
15 | public final boolean isLoggedIn() { | |
16 |
2
1. isLoggedIn : negated conditional → KILLED 2. isLoggedIn : replaced boolean return with true for edu/ucsb/cs156/gauchoride/services/CurrentUserService::isLoggedIn → KILLED |
return getUser() != null; |
17 | } | |
18 | ||
19 | /** | |
20 | * This should only be called in test code, never in production code! | |
21 | * | |
22 | * It resets the current user to a known state for tests, in case | |
23 | * a previous test has changed it in some way. | |
24 | */ | |
25 | public abstract void resetCurrentUser(); | |
26 | } | |
Mutations | ||
16 |
1.1 2.2 |