use of org.apache.cxf.service.model.BindingFaultInfo in project cxf by apache.
the class PolicyInterceptorsTest method testServerPolicyOutFaultInterceptorGetBindingFaultInfo.
@Test
public void testServerPolicyOutFaultInterceptorGetBindingFaultInfo() {
ServerPolicyOutFaultInterceptor interceptor = new ServerPolicyOutFaultInterceptor();
message = control.createMock(Message.class);
Exception ex = new UnsupportedOperationException(new RuntimeException());
boi = control.createMock(BindingOperationInfo.class);
EasyMock.expect(message.get(BindingFaultInfo.class)).andReturn(null);
BindingFaultInfo bfi = control.createMock(BindingFaultInfo.class);
Collection<BindingFaultInfo> bfis = CastUtils.cast(Collections.EMPTY_LIST);
EasyMock.expect(boi.getFaults()).andReturn(bfis);
BindingOperationInfo wrappedBoi = control.createMock(BindingOperationInfo.class);
EasyMock.expect(boi.getWrappedOperation()).andReturn(wrappedBoi).times(2);
Collection<BindingFaultInfo> wrappedBfis = CastUtils.cast(Collections.singletonList(bfi));
EasyMock.expect(wrappedBoi.getFaults()).andReturn(wrappedBfis);
FaultInfo fi = control.createMock(FaultInfo.class);
EasyMock.expect(bfi.getFaultInfo()).andReturn(fi);
EasyMock.expect(fi.getProperty(Class.class.getName(), Class.class)).andReturn(RuntimeException.class);
message.put(BindingFaultInfo.class, bfi);
EasyMock.expectLastCall();
control.replay();
assertSame(bfi, interceptor.getBindingFaultInfo(message, ex, boi));
control.verify();
}
Aggregations