Skip to content
Closed
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt-jackson</artifactId>
<artifactId>jjwt-gson</artifactId>
<version>${jjwt.version}</version>
</dependency>
</dependencies>
Expand Down
2 changes: 1 addition & 1 deletion samples/post-signed-statement/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt-jackson</artifactId>
<artifactId>jjwt-gson</artifactId>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -28,66 +28,60 @@ class DeleteActivityProfileRequestTests {
void whenBuildingDeleteActivityProfileRequestWithAllParametersThenNoExceptionIsThrown() {

// When Building DeleteActivityProfileRequest With All Parameters
Builder<?, ?> builder = DeleteActivityProfileRequest.builder()

.activityId(URI.create("https://example.com/activity/1"))

.profileId("bookmark");
Builder<?, ?> builder =
DeleteActivityProfileRequest.builder()
.activityId(URI.create("https://example.com/activity/1"))
.profileId("bookmark");

// Then No Exception Is Thrown
assertDoesNotThrow(builder::build);

}

@Test
void whenBuildingDeleteActivityProfileRequestWithoutActivityIdThenExceptionIsThrown() {

// When Building DeleteActivityProfileRequest Without ActivityId
Builder<?, ?> builder = DeleteActivityProfileRequest.builder()

.profileId("bookmark");
Builder<?, ?> builder = DeleteActivityProfileRequest.builder().profileId("bookmark");

// Then NullPointerException Is Thrown
assertThrows(NullPointerException.class, builder::build);

}

@Test
void whenBuildingDeleteActivityProfileRequestWithoutStateIdThenExceptionIsThrown() {

// When Building DeleteActivityProfileRequest Without StateId
Builder<?, ?> builder = DeleteActivityProfileRequest.builder()

.activityId(URI.create("https://example.com/activity/1"));
Builder<?, ?> builder =
DeleteActivityProfileRequest.builder()
.activityId(URI.create("https://example.com/activity/1"));

// Then NullPointerException Is Thrown
assertThrows(NullPointerException.class, builder::build);

}

@Test
void givenDeleteActivityProfileRequestWithAllParametersWhenGettingURLThenResultIsExpected() {

// Given DeleteActivityProfileRequest With All Parameters
DeleteActivityProfileRequest request = DeleteActivityProfileRequest.builder()

.activityId(URI.create("https://example.com/activity/1"))

.profileId("bookmark")

.build();
DeleteActivityProfileRequest request =
DeleteActivityProfileRequest.builder()
.activityId(URI.create("https://example.com/activity/1"))
.profileId("bookmark")
.build();

Map<String, Object> queryParams = new HashMap<>();

// When Getting URL
URI result =
request.url(UriComponentsBuilder.fromUriString("https://example.com/xapi/"), queryParams)
request
.url(UriComponentsBuilder.fromUriString("https://example.com/xapi/"), queryParams)
.build(queryParams);

// Then Result Is Expected
assertThat(result, is(URI.create(
"https://example.com/xapi/activities/profile?activityId=https%3A%2F%2Fexample.com%2Factivity%2F1&profileId=bookmark")));

assertThat(
result,
is(
URI.create(
"https://example.com/xapi/activities/profile?activityId=https%3A%2F%2Fexample.com%2Factivity%2F1&profileId=bookmark")));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -28,143 +28,125 @@ class DeleteStateRequestTests {
void whenBuildingDeleteStateRequestWithAllParametersThenNoExceptionIsThrown() {

// When Building DeleteStateRequest With All Parameters
final Builder<?, ?> builder = DeleteStateRequest.builder()

.activityId("https://example.com/activity/1")

.agent(a -> a.name("A N Other").mbox("mailto:another@example.com"))

.registration("67828e3a-d116-4e18-8af3-2d2c59e27be6")

.stateId("bookmark");
final Builder<?, ?> builder =
DeleteStateRequest.builder()
.activityId("https://example.com/activity/1")
.agent(a -> a.name("A N Other").mbox("mailto:another@example.com"))
.registration("67828e3a-d116-4e18-8af3-2d2c59e27be6")
.stateId("bookmark");

// Then No Exception Is Thrown
assertDoesNotThrow(builder::build);

}

@Test
void whenBuildingDeleteStateRequestWithoutRegistrationThenNoExceptionIsThrown() {

// When Building DeleteStateRequest Without Registration
final Builder<?, ?> builder = DeleteStateRequest.builder()

.activityId("https://example.com/activity/1")

.agent(a -> a.name("A N Other").mbox("another@example.com"))

.stateId("bookmark");
final Builder<?, ?> builder =
DeleteStateRequest.builder()
.activityId("https://example.com/activity/1")
.agent(a -> a.name("A N Other").mbox("another@example.com"))
.stateId("bookmark");

// Then No Exception Is Thrown
assertDoesNotThrow(builder::build);

}

@Test
void whenBuildingDeleteStateRequestWithoutActivityIdThenExceptionIsThrown() {

// When Building DeleteStateRequest Without ActivityId
final Builder<?, ?> builder = DeleteStateRequest.builder()

.agent(a -> a.name("A N Other").mbox("another@example.com"))

.registration("67828e3a-d116-4e18-8af3-2d2c59e27be6")

.stateId("bookmark");
final Builder<?, ?> builder =
DeleteStateRequest.builder()
.agent(a -> a.name("A N Other").mbox("another@example.com"))
.registration("67828e3a-d116-4e18-8af3-2d2c59e27be6")
.stateId("bookmark");

// Then NullPointerException Is Thrown
assertThrows(NullPointerException.class, builder::build);

}

@Test
void whenBuildingDeleteStateRequestWithoutAgentThenExceptionIsThrown() {

// When Building DeleteStateRequest Without Agent
final Builder<?, ?> builder = DeleteStateRequest.builder()

.activityId("https://example.com/activity/1")

.registration("67828e3a-d116-4e18-8af3-2d2c59e27be6")

.stateId("bookmark");
final Builder<?, ?> builder =
DeleteStateRequest.builder()
.activityId("https://example.com/activity/1")
.registration("67828e3a-d116-4e18-8af3-2d2c59e27be6")
.stateId("bookmark");

// Then NullPointerException Is Thrown
assertThrows(NullPointerException.class, builder::build);

}

@Test
void whenBuildingDeleteStateRequestWithoutStateIdThenExceptionIsThrown() {

// When Building DeleteStateRequest Without StateId
final Builder<?, ?> builder = DeleteStateRequest.builder()

.activityId("https://example.com/activity/1")

.agent(a -> a.name("A N Other").mbox("another@example.com"))

.registration("67828e3a-d116-4e18-8af3-2d2c59e27be6");
final Builder<?, ?> builder =
DeleteStateRequest.builder()
.activityId("https://example.com/activity/1")
.agent(a -> a.name("A N Other").mbox("another@example.com"))
.registration("67828e3a-d116-4e18-8af3-2d2c59e27be6");

// Then NullPointerException Is Thrown
assertThrows(NullPointerException.class, builder::build);

}

@Test
void givenDeleteStateRequestWithAllParametersWhenGettingURLThenResultIsExpected() {

// Given DeleteStateRequest With All Parameters
final DeleteStateRequest request = DeleteStateRequest.builder()

.activityId("https://example.com/activity/1")

.agent(a -> a.name("A N Other").mbox("another@example.com"))

.registration("67828e3a-d116-4e18-8af3-2d2c59e27be6")

.stateId("bookmark")

.build();
final DeleteStateRequest request =
DeleteStateRequest.builder()
.activityId("https://example.com/activity/1")
.agent(a -> a.name("A N Other").mbox("another@example.com"))
.registration("67828e3a-d116-4e18-8af3-2d2c59e27be6")
.stateId("bookmark")
.build();

final Map<String, Object> queryParams = new HashMap<>();

// When Getting URL
final var result =
request.url(UriComponentsBuilder.fromUriString("https://example.com/xapi/"), queryParams)
request
.url(UriComponentsBuilder.fromUriString("https://example.com/xapi/"), queryParams)
.build(queryParams);

// Then Result Is Expected
assertThat(result, is(URI.create(
"https://example.com/xapi/activities/state?activityId=https%3A%2F%2Fexample.com%2Factivity%2F1&agent=%7B%22name%22%3A%22A%20N%20Other%22%2C%22mbox%22%3A%22another%40example.com%22%7D&registration=67828e3a-d116-4e18-8af3-2d2c59e27be6&stateId=bookmark")));

assertThat(
result,
is(
URI.create(
"https://example.com/xapi/activities/state?activityId=https%3A%2F%2Fexample.com%2Factivity%2F1&agent=%7B%22name%22%3A%22A%20N%20Other%22%2C%22mbox%22%3A%22another%40example.com%22%7D&registration=67828e3a-d116-4e18-8af3-2d2c59e27be6&stateId=bookmark")));
}

@Test
void givenDeleteStateRequestWithoutRegistrationWhenGettingURLThenResultIsExpected() {

// Given DeleteStateRequest Without Registration
final DeleteStateRequest request = DeleteStateRequest.builder()

.activityId("https://example.com/activity/1")

.agent(a -> a.name("A N Other").mbox("another@example.com"))

.stateId("bookmark")

.build();
final DeleteStateRequest request =
DeleteStateRequest.builder()
.activityId("https://example.com/activity/1")
.agent(a -> a.name("A N Other").mbox("another@example.com"))
.stateId("bookmark")
.build();

final Map<String, Object> queryParams = new HashMap<>();

// When Getting URL
final var result =
request.url(UriComponentsBuilder.fromUriString("https://example.com/xapi/"), queryParams)
request
.url(UriComponentsBuilder.fromUriString("https://example.com/xapi/"), queryParams)
.build(queryParams);

// Then Result Is Expected
assertThat(result, is(URI.create(
"https://example.com/xapi/activities/state?activityId=https%3A%2F%2Fexample.com%2Factivity%2F1&agent=%7B%22name%22%3A%22A%20N%20Other%22%2C%22mbox%22%3A%22another%40example.com%22%7D&stateId=bookmark")));

assertThat(
result,
is(
URI.create(
"https://example.com/xapi/activities/state?activityId=https%3A%2F%2Fexample.com%2Factivity%2F1&agent=%7B%22name%22%3A%22A%20N%20Other%22%2C%22mbox%22%3A%22another%40example.com%22%7D&stateId=bookmark")));
}

}
Loading
Loading