List of usage examples for junit.framework Assert assertNull
static public void assertNull(Object object)
From source file:org.b3log.solo.repository.impl.TagRepositoryImplTestCase.java
/** * Get By Title.//from w w w .j a v a 2 s .c om * * @throws Exception exception */ @Test(dependsOnMethods = "add") public void getByTitle() throws Exception { final TagRepository tagRepository = getTagRepository(); final JSONObject found = tagRepository.getByTitle("tag title1"); Assert.assertNotNull(found); Assert.assertEquals(found.getString(Tag.TAG_TITLE), "tag title1"); Assert.assertEquals(found.getInt(Tag.TAG_PUBLISHED_REFERENCE_COUNT), 0); Assert.assertEquals(found.getInt(Tag.TAG_REFERENCE_COUNT), 1); final JSONObject notFound = tagRepository.getByTitle(""); Assert.assertNull(notFound); }
From source file:org.b3log.solo.service.UserMgmtServiceTestCase.java
/** * Remove User.//from www . j a va 2 s . co m * * @throws Exception exception */ @Test(dependsOnMethods = "addUser") public void removeUser() throws Exception { final UserMgmtService userMgmtService = getUserMgmtService(); final JSONObject user = getUserQueryService().getUserByEmail("test1@gmail.com"); Assert.assertNotNull(user); userMgmtService.removeUser(user.getString(Keys.OBJECT_ID)); Assert.assertNull(getUserQueryService().getUserByEmail("test1@gmail.com")); }
From source file:org.b3log.solo.service.UserQueryServiceTestCase.java
/** * Get User./*from w ww. j av a 2 s .c om*/ * * @throws Exception exception */ @Test(dependsOnMethods = "addUser") public void getUser() throws Exception { final UserQueryService userQueryService = getUserQueryService(); Assert.assertNull(userQueryService.getUser("not found")); }
From source file:org.bgp4j.config.impl.ConfigurationParserImplTest.java
@Test public void testEmptyConfiguration() throws Exception { Configuration config = parser.parseConfiguration(loadConfiguration("config/Empty-Config.xml")); Assert.assertNotNull(config);//www .ja va 2 s. c om Assert.assertNull(config.getBgpServerConfiguration()); Assert.assertNull(config.getHttpServerConfiguration()); }
From source file:org.bgp4j.config.impl.ConfigurationParserImplTest.java
@Test(expected = ConfigurationException.class) public void testConfigurationDuplicateBgpServerConfiguration() throws Exception { Configuration config = parser .parseConfiguration(loadConfiguration("config/Config-With-DuplicateBgpServer.xml")); Assert.assertNotNull(config);// ww w. j a v a 2 s .c o m Assert.assertNull(config.getBgpServerConfiguration()); Assert.assertNull(config.getHttpServerConfiguration()); }
From source file:org.bgp4j.config.impl.ConfigurationParserImplTest.java
@Test public void testConfigurationWithBgpServerConfiguration() throws Exception { Configuration config = parser.parseConfiguration(loadConfiguration("config/Config-With-BgpServer.xml")); Assert.assertNotNull(config);/*from w ww . j av a 2 s . c om*/ Assert.assertNotNull(config.getBgpServerConfiguration()); Assert.assertEquals(17179, config.getBgpServerConfiguration().getServerConfiguration().getListenAddress().getPort()); Assert.assertEquals(InetAddress.getByName("192.168.4.1"), config.getBgpServerConfiguration().getServerConfiguration().getListenAddress().getAddress()); Assert.assertNull(config.getHttpServerConfiguration()); }
From source file:org.bgp4j.config.impl.ConfigurationParserImplTest.java
@Test(expected = ConfigurationException.class) public void testConfigurationDuplicateHttpServerConfiguration() throws Exception { Configuration config = parser .parseConfiguration(loadConfiguration("config/Config-With-DuplicateHttpServer.xml")); Assert.assertNotNull(config);/*from w w w . j a va 2 s. c o m*/ Assert.assertNull(config.getBgpServerConfiguration()); Assert.assertNull(config.getHttpServerConfiguration()); }
From source file:org.bgp4j.config.impl.ConfigurationParserImplTest.java
@Test public void testConfigurationWithHttpServerConfiguration() throws Exception { Configuration config = parser.parseConfiguration(loadConfiguration("config/Config-With-HttpServer.xml")); Assert.assertNotNull(config);/*from ww w. j a va2 s . c om*/ Assert.assertNotNull(config.getHttpServerConfiguration()); Assert.assertEquals(8080, config.getHttpServerConfiguration().getServerConfiguration().getListenAddress().getPort()); Assert.assertEquals(InetAddress.getByName("192.168.4.1"), config.getHttpServerConfiguration().getServerConfiguration().getListenAddress().getAddress()); Assert.assertNull(config.getBgpServerConfiguration()); }
From source file:org.bgp4j.config.impl.ConfigurationParserImplTest.java
@Test public void testConfigurationWithTwoBgpPeers() throws Exception { Configuration config = parser.parseConfiguration(loadConfiguration("config/Config-With-BgpPeers.xml")); PeerConfiguration peerConfig;/*from w w w. java 2s.c o m*/ Assert.assertNull(config.getHttpServerConfiguration()); Assert.assertEquals(2, config.listPeerNames().size()); peerConfig = config.getPeer("foo1"); Assert.assertNotNull(peerConfig); Assert.assertEquals(InetAddress.getByName("192.168.4.1"), peerConfig.getClientConfig().getRemoteAddress().getAddress()); Assert.assertEquals(179, peerConfig.getClientConfig().getRemoteAddress().getPort()); Assert.assertEquals(10, peerConfig.getLocalAS()); Assert.assertEquals(11, peerConfig.getRemoteAS()); Assert.assertEquals("foo1", peerConfig.getPeerName()); peerConfig = config.getPeer("foo2"); Assert.assertNotNull(peerConfig); Assert.assertEquals(InetAddress.getByName("192.168.4.2"), peerConfig.getClientConfig().getRemoteAddress().getAddress()); Assert.assertEquals(179, peerConfig.getClientConfig().getRemoteAddress().getPort()); Assert.assertEquals(12, peerConfig.getLocalAS()); Assert.assertEquals(13, peerConfig.getRemoteAS()); Assert.assertEquals("foo2", peerConfig.getPeerName()); }
From source file:org.bgp4j.config.impl.ConfigurationParserImplTest.java
@Test public void testConfigurationWithTwoBgpPeersIPv4BGPIdentifiers() throws Exception { Configuration config = parser .parseConfiguration(loadConfiguration("config/Config-With-BgpPeers-IPv4BGPIdentifier.xml")); PeerConfiguration peerConfig;/*from w w w .j av a2 s .c o m*/ Assert.assertNull(config.getHttpServerConfiguration()); Assert.assertEquals(2, config.listPeerNames().size()); peerConfig = config.getPeer("foo1"); Assert.assertNotNull(peerConfig); Assert.assertEquals(InetAddress.getByName("192.168.4.1"), peerConfig.getClientConfig().getRemoteAddress().getAddress()); Assert.assertEquals(179, peerConfig.getClientConfig().getRemoteAddress().getPort()); Assert.assertEquals(10, peerConfig.getLocalAS()); Assert.assertEquals(11, peerConfig.getRemoteAS()); Assert.assertEquals("foo1", peerConfig.getPeerName()); Assert.assertEquals((192L << 24) | (168L << 16) | (4L << 8) | 1, peerConfig.getLocalBgpIdentifier()); Assert.assertEquals((192L << 24) | (168L << 16) | (4L << 8) | 2, peerConfig.getRemoteBgpIdentifier()); peerConfig = config.getPeer("foo2"); Assert.assertNotNull(peerConfig); Assert.assertEquals(InetAddress.getByName("192.168.4.2"), peerConfig.getClientConfig().getRemoteAddress().getAddress()); Assert.assertEquals(179, peerConfig.getClientConfig().getRemoteAddress().getPort()); Assert.assertEquals(12, peerConfig.getLocalAS()); Assert.assertEquals(13, peerConfig.getRemoteAS()); Assert.assertEquals("foo2", peerConfig.getPeerName()); Assert.assertEquals((192L << 24) | (168L << 16) | (4 << 8) | 1, peerConfig.getLocalBgpIdentifier()); Assert.assertEquals((192L << 24) | (168L << 16) | (4 << 8) | 3, peerConfig.getRemoteBgpIdentifier()); }