DirectAuthoriseServiceResponse extends AbstractServiceResponse { public Optional<ThreeDSecureVersionEnum> get3DSecureVersion() { if (getRequest3DInfo() != null) { if (V1.equals(getRequest3DInfo().getMajor3DSVersion())) { return Optional.of(ThreeDSecureVersionEnum.V1); } if (V2.equals(getRequest3DInfo().getMajor3DSVersion())) { return Optional.of(ThreeDSecureVersionEnum.V2); } } return Optional.empty(); }  Optional<ThreeDSecureVersionEnum> get3DSecureVersion(); Optional<ThreeDSecureFlowEnum> get3DSecureFlow(); Request3DInfo getRequest3DInfo(); void setRequest3DInfo(final Request3DInfo request3DInfo); PaymentReply getPaymentReply(); void setPaymentReply(final PaymentReply paymentReply); RedirectReference getRedirectReference(); void setRedirectReference(final RedirectReference redirectReference); String getEchoData(); void setEchoData(final String echoData); TokenReply getToken(); void setToken(final TokenReply token);  }
@Test public void get3DSecureVersionReturnsAnEmptyOptionalIfThereIsNot3DSecureInfo() { final DirectAuthoriseServiceResponse testObj = new DirectAuthoriseServiceResponse(); final Optional<ThreeDSecureVersionEnum> result = testObj.get3DSecureVersion(); assertThat(result).isEmpty(); }