Skip to content
This repository was archived by the owner on Apr 5, 2024. It is now read-only.

Commit 045cb40

Browse files
committed
Fixed test.
1 parent 3247b39 commit 045cb40

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

src/test/java/de/filefighter/rest/cucumber/UserAuthorizationSteps.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,15 @@ public void accessTokenWithValueExistsForUserAndIsValidUntil(String tokenValue,
4141
.userId(userId)
4242
.value(tokenValue)
4343
.validUntil(validUntil)
44-
.validUntil(Instant.now().getEpochSecond()+ ACCESS_TOKEN_DURATION_IN_SECONDS).build());
44+
.build());
4545
}
4646

4747
@Given("accessToken with value {string} exists for user {long}")
4848
public void accessTokenWithValueExistsForUser(String tokenValue, long userId) {
4949
accessTokenRepository.save(AccessTokenEntity.builder()
5050
.userId(userId)
5151
.value(tokenValue)
52-
.validUntil(Instant.now().getEpochSecond()+ ACCESS_TOKEN_DURATION_IN_SECONDS).build());
52+
.validUntil(Instant.now().getEpochSecond() + ACCESS_TOKEN_DURATION_IN_SECONDS).build());
5353
}
5454

5555
@When("user requests login with username {string} and password {string}")
@@ -116,7 +116,7 @@ public void responseContainsRefreshTokenAndTheUserWithId(String refreshToken, lo
116116
}
117117

118118
@And("response contains valid accessToken for user {long} with a different value than {string}")
119-
public void responseContainsValidAccessTokenForUserWithADifferentValueThan(int userId, String differentTokenValue) throws JsonProcessingException {
119+
public void responseContainsValidAccessTokenForUserWithADifferentValueThan(long userId, String differentTokenValue) throws JsonProcessingException {
120120
JsonNode rootNode = objectMapper.readTree(latestResponse.getBody());
121121
String actualTokenValue = rootNode.get("token").asText();
122122
long actualUserId = rootNode.get("userId").asLong();

src/test/resources/SystemHealth.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Scenario: SystemHealth is requested without users in db
1313
Scenario: SystemHealth is requested with users in db
1414
Given user 1234 exists
1515
And user 3214 exists
16-
And the user waits for 1 second(s)
16+
And the user waits for 2 second(s)
1717
When the systemHealth endpoint is requested
1818
Then response contains key "userCount" and value "2"
1919
And response contains key "uptimeInSeconds" and value of at least 1

src/test/resources/UserAuthorization.feature

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ Scenario: Successful retrieval of existing accessToken with refreshToken.
3131
And response contains valid accessToken for user 1234
3232
And response status code is 200
3333

34-
Scenario: Successful retrieval of freshly created accessToken with refreshToken
34+
# Better scenario description?
35+
Scenario: Successful retrieval of overwritten accessToken with refreshToken
3536
Given accessToken with value "6bb9cb4f-7b51-4c0a-8013-ed7a34e56282" exists for user 1234 and is valid until 0
3637
When user requests accessToken with refreshToken "token" and userId 1234
3738
Then response contains key "userId" and value "1234"

0 commit comments

Comments
 (0)