### Question:
Proxy { void acknowledge(DestinationSequence ds) throws RMException { final ProtocolVariation protocol = ds.getProtocol(); String address = ds.getAcksTo().getAddress().getValue(); if (RMUtils.getAddressingConstants().getAnonymousURI().equals(address)) { LOG.log(Level.WARNING, "STANDALONE_ANON_ACKS_NOT_SUPPORTED"); return; } RMConstants constants = protocol.getConstants(); OperationInfo oi = reliableEndpoint.getEndpoint(protocol).getEndpointInfo() .getService().getInterface().getOperation(constants.getSequenceAckOperationName()); invoke(oi, protocol, new Object[] {ds}, this.sequenceContext); } Proxy(RMEndpoint rme); CreateSequenceResponseType createSequence(EndpointReferenceType defaultAcksTo, RelatesToType relatesTo,
             boolean isServer, final ProtocolVariation protocol, final Exchange exchange, Map<String, Object> context);  }### Answer:
@Test public void testAcknowledgeNotSupported() throws RMException { DestinationSequence ds = control.createMock(DestinationSequence.class); EndpointReferenceType acksToEPR = control.createMock(EndpointReferenceType.class); EasyMock.expect(ds.getAcksTo()).andReturn(acksToEPR).anyTimes(); AttributedURIType acksToURI = control.createMock(AttributedURIType.class); EasyMock.expect(acksToEPR.getAddress()).andReturn(acksToURI).anyTimes(); String acksToAddress = Names.WSA_ANONYMOUS_ADDRESS; EasyMock.expect(acksToURI.getValue()).andReturn(acksToAddress).anyTimes(); control.replay(); Proxy proxy = new Proxy(rme); proxy.acknowledge(ds); }
@Test public void testAcknowledge() throws NoSuchMethodException, RMException { Method m = Proxy.class.getDeclaredMethod("invoke", new Class[] {OperationInfo.class, ProtocolVariation.class, Object[].class, Map.class}); Proxy proxy = EasyMock.createMockBuilder(Proxy.class) .addMockedMethod(m).createMock(control); proxy.setReliableEndpoint(rme); DestinationSequence ds = control.createMock(DestinationSequence.class); EasyMock.expect(ds.getProtocol()).andReturn(ProtocolVariation.RM10WSA200408).anyTimes(); EndpointReferenceType acksToEPR = control.createMock(EndpointReferenceType.class); EasyMock.expect(ds.getAcksTo()).andReturn(acksToEPR).anyTimes(); AttributedURIType acksToURI = control.createMock(AttributedURIType.class); EasyMock.expect(acksToEPR.getAddress()).andReturn(acksToURI).anyTimes(); String acksToAddress = "acksTo"; EasyMock.expect(acksToURI.getValue()).andReturn(acksToAddress).anyTimes(); Endpoint endpoint = control.createMock(Endpoint.class); EasyMock.expect(rme.getEndpoint(ProtocolVariation.RM10WSA200408)).andReturn(endpoint).anyTimes(); EndpointInfo epi = control.createMock(EndpointInfo.class); EasyMock.expect(endpoint.getEndpointInfo()).andReturn(epi).anyTimes(); ServiceInfo si = control.createMock(ServiceInfo.class); EasyMock.expect(epi.getService()).andReturn(si).anyTimes(); InterfaceInfo ii = control.createMock(InterfaceInfo.class); EasyMock.expect(si.getInterface()).andReturn(ii).anyTimes(); OperationInfo oi = control.createMock(OperationInfo.class); EasyMock.expect(ii.getOperation(RM10Constants.SEQUENCE_ACK_QNAME)).andReturn(oi).anyTimes(); expectInvoke(proxy, oi, null); control.replay(); proxy.acknowledge(ds); }