Advertisement
Guest User

Untitled

a guest
Dec 17th, 2018
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
ABAP 0.97 KB | None | 0 0
  1. METHOD configuration_exception.
  2.  
  3.     DATA: lo_currency_converter_double TYPE REF TO if_td_currency_converter,
  4.           lo_expense_manager          TYPE REF TO cl_td_expense_manager,
  5.           lv_exp_total_expense        TYPE i,
  6.           lo_exception                TYPE REF TO cx_td_currency_exception.
  7.  
  8.     FIELD-SYMBOLS: <lv_value> TYPE string.
  9.  
  10. *create test double object
  11.     lo_currency_converter_double ?= cl_abap_testdouble=>create( ‘if_td_currency_converter’ ).
  12.  
  13.     “instantiate the exception object
  14.     CREATE OBJECT lo_exception.
  15.  
  16. *configuration for exception. The specified exception gets raised if amount = -1, source_currency = USD “and target_currency = ‘EUR’
  17.     cl_abap_testdouble=>configure_call( lo_currency_converter_double )->raise_exception( lo_exception ).
  18.     lo_currency_converter_double->convert(
  19.       EXPORTING
  20.         amount          = -1
  21.         source_currency = ‘USD’
  22.         target_currency = ‘EUR’
  23.     ).
  24.  
  25.   ENDMETHOD.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement