### Question:
OffersClientRest extends BaseClientRest implements OffersClient { @Override public void editOffer(OfferPutRequest offerPutRequest, StreamObserver<Offer> offerObserver) { String url = buildSportsUrl(offerPutRequest.resourcePath()); putRequest(url, offerPutRequest, offerObserver, new OfferReader()); } OffersClientRest(ConnectionManager connectionManager); @Override void getOffer(OfferGetRequest offerGetRequest, StreamObserver<Offer> offerObserver); @Override void getOffers(OffersGetRequest offersGetRequest, StreamObserver<Offer> offersObserver); @Override void getOfferEdit(OfferEditGetRequest offerEditGetRequest, StreamObserver<OfferEdit> offerEditObserver); @Override void getOfferEdits(OfferEditsGetRequest offerEditsGetRequest, StreamObserver<OfferEdit> offerEditsObserver); @Override void getPositions(PositionsRequest positionsRequest, StreamObserver<Position> positionsRequestObserver); @Override void getAggregatedMatchedBets(AggregatedMatchedBetsRequest aggregatedMatchedBetsRequest,
            StreamObserver<AggregatedMatchedBet> aggregatedMatchedBetsObserver); @Override void getCancelledMatchedBets(CancelledMatchedBetsRequest cancelledMatchedBetsRequest,
            StreamObserver<MatchedBet> cancelledMatchedBetsObserver); @Override void submitOffers(OffersPostRequest offersPostRequest, StreamObserver<Offer> offersObserver); @Override void editOffer(OfferPutRequest offerPutRequest, StreamObserver<Offer> offerObserver); @Override void editOffers(OffersPutRequest offersPutRequest, StreamObserver<Offer> offersObserver); @Override void cancelOffer(OfferDeleteRequest offerDeleteRequest, StreamObserver<Offer> offerObserver); @Override void cancelOffers(OffersDeleteRequest offersDeleteRequest, StreamObserver<Offer> offersObserver);  }### Answer:
@Test @DisplayName("PUT offer successfully") void editOfferSuccessTest() throws IOException { when(connectionManager.getHttpClient()).thenReturn(httpClient); when(serializer.writeObjectAsString(any(OfferPutRequest.class))).thenReturn("{}"); OfferPutRequest offerPutRequest = mock(OfferPutRequest.class); when(offerPutRequest.resourcePath()).thenReturn("path/42"); StreamObserver<Offer> streamObserver = (StreamObserver<Offer>) mock(StreamObserver.class); unit.editOffer(offerPutRequest, streamObserver); verify(httpClient).put(eq("https: any(ResponseCallback.class)); }
@Test @DisplayName("PUT offer parsing failure") void editOfferFailureTest() throws IOException { doThrow(IOException.class).when(serializer).writeObjectAsString(any(OfferPutRequest.class)); OfferPutRequest offerPutRequest = mock(OfferPutRequest.class); when(offerPutRequest.resourcePath()).thenReturn("path/42"); StreamObserver<Offer> streamObserver = (StreamObserver<Offer>) mock(StreamObserver.class); unit.editOffer(offerPutRequest, streamObserver); verify(streamObserver).onError(any(MatchbookSDKParsingException.class)); verify(httpClient, never()).put(anyString(), anyString(), any(ResponseCallback.class)); }