@Test
public void registerAnonymously() throws Exception {

  // Arrange
  URI expectedUri = URI.create("http://localhost:8080/mbm/client/user/anonymous");
  // Test-specific JerseyClient behaviour
  when(client.resource(expectedUri)).thenReturn(webResource);
  // No entity so use resource not builder
  when(webResource.post(String.class)).thenReturn(
    FixtureAsserts.jsonFixture("/fixtures/hal/user/expected-client-register-anonymous-user.json")
  );
  // Act
  Optional<UserDto> publicUser = PublicMerchantClient
    .newInstance(locale)
    .user()
    .registerAnonymously();
  // Assert
  assertTrue("Expected user", publicUser.isPresent());
  assertEquals("bob123",publicUser.get().getApiKey());
  assertEquals("bob456",publicUser.get().getSecretKey());
}