Skip to content

Instantly share code, notes, and snippets.

View Adrianvdh's full-sized avatar

Adrian van den Houten Adrianvdh

  • Takealot.com
  • Cape Town
View GitHub Profile
::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
@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);
public class AuthorisationContext {
}
public class User {
String username;
String password;
}
public class AuthorisationContext {
public void authenticate(String username, String password) {
}
}
public class User {
String username = "adrianvdh";
String password = "hello123";
}
public class UserService {
public User authenicate(String username, String password) {
User user = new User();
user.username = "adrianvdh";
user.password = "hello123";
return user;
}
}
public class UserService {
List<User> users = new ArrayList<>();
{
User user = new User();
user.username = "adrianvdh";
user.password = "hello123";
users.add(user);
}
class UserService {
List<User> users = new ArrayList<>();
{
User user = new User();
user.username = "adrianvdh";
user.password = "hello123";
users.add(user);
}
@Test(expected = RuntimeException.class)
public void userLoginWhereUserIsNotFound() {
String username = "kentbeck";
String password = "letmein";
UserService userService = new UserService();
User user = userService.authenticate(username, password);
}