This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
::Date & Time Calculation START | |
:GetInternational | |
for /f "tokens=1,2*" %%a in ('reg query "HKCU\Control Panel\International"^|find "REG_SZ" ') do set "%%a=%%c" | |
exit /b | |
:GetSecs "dateIn" "timeIn" secondsOut | |
setlocal | |
set "dateIn=%~1" | |
for /f "tokens=2" %%i in ("%dateIn%") do set "dateIn=%%i" | |
for /f "tokens=1-3 delims=%sDate%" %%a in ("%dateIn%") do ( | |
if %iDate%==0 set /a mm=100%%a%%100,dd=100%%b%%100,yy=10000%%c%%10000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
public void userLoginWithCorrectCredentials() throws Exception { | |
// Given that this user exists | |
String username = "adrianvdh"; | |
String password = "hello123"; | |
AuthorisationContext authorisationContext = new AuthorisationContext(); | |
// When authenticating | |
authorisationContext.authenticate(username, password); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class AuthorisationContext { | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class User { | |
String username; | |
String password; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class AuthorisationContext { | |
public void authenticate(String username, String password) { | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class User { | |
String username = "adrianvdh"; | |
String password = "hello123"; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class UserService { | |
public User authenicate(String username, String password) { | |
User user = new User(); | |
user.username = "adrianvdh"; | |
user.password = "hello123"; | |
return user; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class UserService { | |
List<User> users = new ArrayList<>(); | |
{ | |
User user = new User(); | |
user.username = "adrianvdh"; | |
user.password = "hello123"; | |
users.add(user); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class UserService { | |
List<User> users = new ArrayList<>(); | |
{ | |
User user = new User(); | |
user.username = "adrianvdh"; | |
user.password = "hello123"; | |
users.add(user); | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test(expected = RuntimeException.class) | |
public void userLoginWhereUserIsNotFound() { | |
String username = "kentbeck"; | |
String password = "letmein"; | |
UserService userService = new UserService(); | |
User user = userService.authenticate(username, password); | |
} |
OlderNewer