MAMModule extends DefaultDiscoAwareModule implements ServerInfoRequestListener { @Override public List<InfoElement> getServerInfosFor(InfoRequest request) { List<InfoElement> infoElements = new ArrayList<>(); infoElements.add(new Feature(NamespaceURIs.XEP0359_STANZA_IDS)); infoElements.add(new Feature(NamespaceURIs.JABBER_X_DATA)); return infoElements; }  @Override void initialize(ServerRuntimeContext serverRuntimeContext); @Override String getName(); @Override String getVersion(); @Override List<InfoElement> getServerInfosFor(InfoRequest request); @Override List<StanzaHandlerInterceptor> getStanzaHandlerInterceptors();  }
@Test public void getServerInfosFor() throws ServiceDiscoveryRequestException { List<ServerInfoRequestListener> serverInfoRequestListeners = new ArrayList<>(); tested.addServerInfoRequestListeners(serverInfoRequestListeners); Assert.assertEquals(1, serverInfoRequestListeners.size()); List<InfoElement> infoElements = serverInfoRequestListeners.get(0) .getServerInfosFor(new InfoRequest(null, null, null, null)); Assert.assertEquals(2, infoElements.size()); Assert.assertTrue(infoElements.get(0) instanceof Feature); Assert.assertTrue(infoElements.get(1) instanceof Feature); Assert.assertEquals(NamespaceURIs.XEP0359_STANZA_IDS, ((Feature) infoElements.get(0)).getVar()); Assert.assertEquals(NamespaceURIs.JABBER_X_DATA, ((Feature) infoElements.get(1)).getVar()); }