XmppConnectionFactoryBean implements FactoryBean<XMPPTCPConnection>, InitializingBean, DisposableBean { public void setPort(int port) { Assert.isTrue(port > 0, "'port' must be larger than 0"); this.port = port; }  void setHost(String host); void setPort(int port); void setServiceName(String serviceName); void setUsername(String username); void setPassword(String password); void setResource(String resource); @Override void afterPropertiesSet(); @Override void destroy(); @Override XMPPTCPConnection getObject(); @Override Class<XMPPTCPConnection> getObjectType(); @Override boolean isSingleton();  }
@Test(expected = IllegalArgumentException.class) public void wrongPort() throws XMPPException { factoryBean.setPort(-10); }