Skip to content

Commit

Permalink
renamed bean
Browse files Browse the repository at this point in the history
  • Loading branch information
tanjaFrejaEid committed Dec 14, 2023
1 parent bf0e124 commit b46b08e
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@

import java.util.Objects;

public class UpdateStatus {
public class UpdateOrganisationIdStatus {

private final int added;
private final int updated;
private final int deleted;

@JsonCreator
public UpdateStatus(@JsonProperty("added") int added,
@JsonProperty("updated") int updated,
@JsonProperty("deleted") int deleted) {
public UpdateOrganisationIdStatus(@JsonProperty("added") int added,
@JsonProperty("updated") int updated,
@JsonProperty("deleted") int deleted) {
this.added = added;
this.updated = updated;
this.deleted = deleted;
Expand All @@ -35,8 +35,8 @@ public int getDeleted() {
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof UpdateStatus)) return false;
UpdateStatus that = (UpdateStatus) o;
if (!(o instanceof UpdateOrganisationIdStatus)) return false;
UpdateOrganisationIdStatus that = (UpdateOrganisationIdStatus) o;
return added == that.added && updated == that.updated && deleted == that.deleted;
}

Expand All @@ -47,7 +47,7 @@ public int hashCode() {

@Override
public String toString() {
return "UpdateStatus{" +
return "UpdateOrganisationIdStatus{" +
"added=" + added +
", updated=" + updated +
", deleted=" + deleted +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,40 +3,41 @@
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.verisec.frejaeid.client.beans.common.FrejaHttpResponse;
import com.verisec.frejaeid.client.beans.general.UpdateStatus;
import com.verisec.frejaeid.client.beans.general.UpdateOrganisationIdStatus;

import java.util.Objects;

public class UpdateOrganisationIdResponse implements FrejaHttpResponse {

private final UpdateStatus updateStatus;
private final UpdateOrganisationIdStatus updateOrganisationIdStatus;

@JsonCreator
public UpdateOrganisationIdResponse(@JsonProperty("updateStatus") UpdateStatus updateStatus) {
this.updateStatus = updateStatus;
public UpdateOrganisationIdResponse(
@JsonProperty("updateOrganisationIdStatus") UpdateOrganisationIdStatus updateOrganisationIdStatus) {
this.updateOrganisationIdStatus = updateOrganisationIdStatus;
}

public UpdateStatus getUpdateStatus() {
return updateStatus;
public UpdateOrganisationIdStatus getUpdateOrganisationIdStatus() {
return updateOrganisationIdStatus;
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof UpdateOrganisationIdResponse)) return false;
UpdateOrganisationIdResponse that = (UpdateOrganisationIdResponse) o;
return Objects.equals(updateStatus, that.updateStatus);
return Objects.equals(updateOrganisationIdStatus, that.updateOrganisationIdStatus);
}

@Override
public int hashCode() {
return Objects.hash(updateStatus);
return Objects.hash(updateOrganisationIdStatus);
}

@Override
public String toString() {
return "UpdateOrganisationIdResponse{" +
"updateStatus=" + updateStatus +
"updateOrganisationIdStatus=" + updateOrganisationIdStatus +
'}';
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
package com.verisec.frejaeid.client.client.impl;

import com.verisec.frejaeid.client.beans.common.EmptyFrejaResponse;
import com.verisec.frejaeid.client.beans.common.RelyingPartyRequest;
import com.verisec.frejaeid.client.beans.general.OrganisationIdAttribute;
import com.verisec.frejaeid.client.beans.general.UpdateStatus;
import com.verisec.frejaeid.client.beans.organisationid.delete.DeleteOrganisationIdRequest;
import com.verisec.frejaeid.client.beans.general.UpdateOrganisationIdStatus;
import com.verisec.frejaeid.client.beans.organisationid.update.UpdateOrganisationIdRequest;
import com.verisec.frejaeid.client.beans.organisationid.update.UpdateOrganisationIdResponse;
import com.verisec.frejaeid.client.client.api.OrganisationIdClientApi;
Expand Down Expand Up @@ -46,7 +44,7 @@ public void initialiseClient() throws FrejaEidClientInternalException {
public void updateOrgId_withoutRelyingPartyId_success() throws FrejaEidClientInternalException, FrejaEidException {
UpdateOrganisationIdRequest updateOrganisationIdRequest =
UpdateOrganisationIdRequest.create(IDENTIFIER, ADDITIONAL_ATTRIBUTES);
UpdateOrganisationIdResponse expectedResponse = new UpdateOrganisationIdResponse(new UpdateStatus(0, 2, 0));
UpdateOrganisationIdResponse expectedResponse = new UpdateOrganisationIdResponse(new UpdateOrganisationIdStatus(0, 2, 0));
Mockito.when(httpServiceMock.send(Mockito.anyString(), Mockito.any(RequestTemplate.class),
Mockito.any(RelyingPartyRequest.class),
Mockito.eq(UpdateOrganisationIdResponse.class), (String) Mockito.isNull()))
Expand All @@ -62,7 +60,7 @@ public void updateOrgId_withoutRelyingPartyId_success() throws FrejaEidClientInt
public void updateOrgId_withRelyingPartyId_success() throws FrejaEidClientInternalException, FrejaEidException {
UpdateOrganisationIdRequest updateOrganisationIdRequest =
UpdateOrganisationIdRequest.create(IDENTIFIER, ADDITIONAL_ATTRIBUTES, RELYING_PARTY_ID);
UpdateOrganisationIdResponse expectedResponse = new UpdateOrganisationIdResponse(new UpdateStatus(1, 0, 1));
UpdateOrganisationIdResponse expectedResponse = new UpdateOrganisationIdResponse(new UpdateOrganisationIdStatus(1, 0, 1));
Mockito.when(httpServiceMock.send(Mockito.anyString(), Mockito.any(RequestTemplate.class),
Mockito.any(RelyingPartyRequest.class),
Mockito.eq(UpdateOrganisationIdResponse.class), Mockito.eq(RELYING_PARTY_ID)))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ public void updateOrganisationId_sendRequestWithoutRelyingPartyId_success()
throws FrejaEidClientInternalException, IOException, FrejaEidException {
UpdateOrganisationIdRequest updateOrganisationIdRequest =
UpdateOrganisationIdRequest.create(IDENTIFIER, ADDITIONAL_ATTRIBUTES);
UpdateOrganisationIdResponse expectedResponse = new UpdateOrganisationIdResponse(new UpdateStatus(1, 1, 0));
UpdateOrganisationIdResponse expectedResponse = new UpdateOrganisationIdResponse(new UpdateOrganisationIdStatus(1, 1, 0));
String responseString = jsonService.serializeToJson(expectedResponse);
startMockServer(updateOrganisationIdRequest, HttpStatusCode.OK.getCode(), responseString);
UpdateOrganisationIdResponse receivedResponse = organisationIdClient.update(updateOrganisationIdRequest);
Expand All @@ -267,7 +267,7 @@ public void updateOrganisationId_sendRequestWithRelyingPartyId_success()
throws FrejaEidClientInternalException, IOException, FrejaEidException {
UpdateOrganisationIdRequest updateOrganisationIdRequest =
UpdateOrganisationIdRequest.create(IDENTIFIER, ADDITIONAL_ATTRIBUTES, RELYING_PARTY_ID);
UpdateOrganisationIdResponse expectedResponse = new UpdateOrganisationIdResponse(new UpdateStatus(0, 2, 0));
UpdateOrganisationIdResponse expectedResponse = new UpdateOrganisationIdResponse(new UpdateOrganisationIdStatus(0, 2, 0));
String responseString = jsonService.serializeToJson(expectedResponse);
startMockServer(updateOrganisationIdRequest, HttpStatusCode.OK.getCode(), responseString);
UpdateOrganisationIdResponse receivedResponse = organisationIdClient.update(updateOrganisationIdRequest);
Expand Down

0 comments on commit b46b08e

Please sign in to comment.