List of usage examples for junit.framework Assert assertFalse
static public void assertFalse(boolean condition)
From source file:com.idtmatter.insta4j.client.FullInstaClientTest.java
@Test public void testDeleteBookmark() { final FullInstaClient client = FullInstaClient.create("jinstapaper@gmail.com", "open"); final List<InstaRecordBean> folders = client.listFolders(); Assert.assertNotNull(folders);/*from w w w. j a v a2 s . c o m*/ Assert.assertFalse(folders.isEmpty()); final InstaRecordBean firstFolder = folders.get(0); final InstaRecordBean initBookmark = client.addBookmark( "http://www.nytimes.com/pages/todayspaper/index.html?src=hp1-0-P#nytfrontpage", "DeleteBookmarkTest", firstFolder.folder_id, false); Assert.assertTrue(client.deleteBookmark(initBookmark.bookmark_id)); }
From source file:com.linkedin.pinot.core.data.manager.realtime.LLRealtimeSegmentDataManagerTest.java
@Test public void testHolding() throws Exception { FakeLLRealtimeSegmentDataManager segmentDataManager = createFakeSegmentManager(); LLRealtimeSegmentDataManager.PartitionConsumer consumer = segmentDataManager.createPartitionConsumer(); final long endOffset = _startOffset + 500; // We should consume initially... segmentDataManager._consumeOffsets.add(endOffset); final SegmentCompletionProtocol.Response response = new SegmentCompletionProtocol.Response( new SegmentCompletionProtocol.Response.Params() .withStatus(SegmentCompletionProtocol.ControllerResponseStatus.HOLD).withOffset(endOffset)); // And then never consume as long as we get a hold response, 100 times. for (int i = 0; i < 100; i++) { segmentDataManager._responses.add(response); }//from ww w . j a va2s. c o m consumer.run(); Assert.assertTrue(segmentDataManager._responses.isEmpty()); Assert.assertTrue(segmentDataManager._consumeOffsets.isEmpty()); Assert.assertFalse(segmentDataManager._buildAndReplaceCalled); Assert.assertFalse(segmentDataManager._buildSegmentCalled); Assert.assertFalse(segmentDataManager._commitSegmentCalled); Assert.assertFalse(segmentDataManager._downloadAndReplaceCalled); Assert.assertEquals(segmentDataManager._state.get(segmentDataManager), LLRealtimeSegmentDataManager.State.HOLDING); }
From source file:de.itsvs.cwtrpc.controller.AutowiredRemoteServiceGroupConfigTest.java
@Test public void testIsAcceptedServiceInterface6() { final AutowiredRemoteServiceGroupConfig config; config = new AutowiredRemoteServiceGroupConfig(); config.setBasePackages(Arrays.asList(new String[] { "de.itsvs.cwtrpc.controller.config." })); config.setExcludeFilters(Arrays.asList(new Pattern[] { PatternFactory.compile(PatternType.REGEX, MatcherType.PACKAGE, "de\\..+\\.TestService[13]"), PatternFactory.compile(PatternType.REGEX, MatcherType.PACKAGE, "de\\..+\\.TestService5") })); Assert.assertFalse(config.isAcceptedServiceInterface(TestService1.class)); Assert.assertTrue(config.isAcceptedServiceInterface(TestService2.class)); Assert.assertFalse(config.isAcceptedServiceInterface(TestService3.class)); Assert.assertFalse(config.isAcceptedServiceInterface(TestService5.class)); }
From source file:com.github.venkateshamurthy.designpatterns.builders.TestFluentBuilders.java
/** * Test create.//from w w w . ja v a 2 s . co m * * @throws NotFoundException * the not found exception * @throws CannotCompileException * the cannot compile exception * @throws IOException * Signals that an I/O exception has occurred. */ @Test public void testCreate() throws NotFoundException, CannotCompileException, IOException { FluentBuilders fluentBuilderGenerator = FluentBuilders.create(); Assert.assertNotNull(fluentBuilderGenerator); Assert.assertNotNull(fluentBuilderGenerator.getSourceFolderRoot()); Assert.assertNotNull(fluentBuilderGenerator.getSetMethodNamePattern()); Assert.assertNotNull(fluentBuilderGenerator.getFluentbuilderclass()); Assert.assertEquals(new File(FluentBuilders.TYPICAL_SOURCE_FOLDER), fluentBuilderGenerator.getSourceFolderRoot()); Assert.assertEquals(FluentBuilders.TYPICAL_SET_METHOD_PATTERN, fluentBuilderGenerator.getSetMethodNamePattern().pattern()); File file1 = getFile(fluentBuilderGenerator.getSourceFolderRoot(), Pojo1.class); File file2 = getFile(fluentBuilderGenerator.getSourceFolderRoot(), Pojo2.class); try { fluentBuilderGenerator.writeInterface(Pojo1.class, Pojo2.class); } catch (IllegalArgumentException iae) { // ignore as this is expected since pojo1 and pojo2 are non public class and hence wont exist so assert that Assert.assertFalse(file1.exists()); Assert.assertFalse(file2.exists()); } List<Class<?>> failedList = fluentBuilderGenerator.writeInterface(Pojo3.class, Pojo4.class); Assert.assertTrue(failedList.isEmpty()); File file3 = getFile(fluentBuilderGenerator.getSourceFolderRoot(), Pojo3.class); File file4 = getFile(fluentBuilderGenerator.getSourceFolderRoot(), Pojo4.class); Assert.assertTrue(file3.exists()); Assert.assertTrue(file4.exists()); failedList = fluentBuilderGenerator.writeInterface(Pojo5.class); Assert.assertEquals(1, failedList.size()); Assert.assertEquals(Pojo5.class, failedList.get(0)); file1.delete(); file2.delete(); file3.delete(); file4.delete(); }
From source file:BQJDBC.QueryResultTest.BQForwardOnlyResultSetFunctionTest.java
@Test public void TestResultSetNext() { try {/* w ww . java 2 s . c om*/ // Assert.assertTrue(BQForwardOnlyResultSetFunctionTest.Result.first()); Assert.assertTrue(BQForwardOnlyResultSetFunctionTest.Result.next()); Assert.assertTrue(BQForwardOnlyResultSetFunctionTest.Result.next()); Assert.assertEquals("yet", BQForwardOnlyResultSetFunctionTest.Result.getString(1)); Assert.assertTrue(BQForwardOnlyResultSetFunctionTest.Result.next()); Assert.assertEquals("would", BQForwardOnlyResultSetFunctionTest.Result.getString(1)); Assert.assertTrue(BQForwardOnlyResultSetFunctionTest.Result.next()); Assert.assertEquals("world", BQForwardOnlyResultSetFunctionTest.Result.getString(1)); Assert.assertTrue(BQForwardOnlyResultSetFunctionTest.Result.next()); Assert.assertEquals("without", BQForwardOnlyResultSetFunctionTest.Result.getString(1)); Assert.assertTrue(BQForwardOnlyResultSetFunctionTest.Result.next()); Assert.assertEquals("with", BQForwardOnlyResultSetFunctionTest.Result.getString(1)); Assert.assertTrue(BQForwardOnlyResultSetFunctionTest.Result.next()); Assert.assertEquals("your", BQForwardOnlyResultSetFunctionTest.Result.getString(1)); Assert.assertTrue(BQForwardOnlyResultSetFunctionTest.Result.next()); Assert.assertEquals("young", BQForwardOnlyResultSetFunctionTest.Result.getString(1)); Assert.assertTrue(BQForwardOnlyResultSetFunctionTest.Result.next()); Assert.assertEquals("words", BQForwardOnlyResultSetFunctionTest.Result.getString(1)); Assert.assertTrue(BQForwardOnlyResultSetFunctionTest.Result.next()); Assert.assertEquals("word", BQForwardOnlyResultSetFunctionTest.Result.getString(1)); Assert.assertFalse(BQForwardOnlyResultSetFunctionTest.Result.next()); } catch (SQLException e) { this.logger.error("SQLexception" + e.toString()); Assert.fail("SQLException" + e.toString()); } try { Assert.assertEquals("", BQForwardOnlyResultSetFunctionTest.Result.getString(1)); } catch (SQLException e) { Assert.assertTrue(true); } }
From source file:es.tekniker.framework.ktek.questionnaire.mng.server.test.TestQuestionnaireMngServer.java
public void testSaveKtekQuestionnaireMonitoringWithParameters() { log.info("*************************************************************"); log.info("testSaveKtekQuestionnaireMonitoringWithParameters: START "); String result = TestDefines.RESULT_OK; String token = null;/*from w w w. j a va2s. com*/ KtekQuestionnaireResultEntity resultData = null; QuestionnaireMngServer manager = new QuestionnaireMngServer(); int boolOK = 0; try { token = TestData.getLoginToken(); resultData = es.tekniker.framework.ktek.questionnaire.mng.db.TestData .getKtekQuestionnaireMonitoringResultEntityWithParameters(); boolOK = manager.saveQuestionnaireModel(token, resultData); if (boolOK == 1) { log.info("testSaveKtekQuestionnaireMonitoringWithParameters: SAVE OK "); Assert.assertTrue(true); } else { log.error("testSaveKtekQuestionnaireMonitoringWithParameters: SAVE ERROR "); result = TestDefines.RESULT_ERROR; Assert.assertTrue(false); } } catch (KtekExceptionEntity e) { System.out.println("testSaveKtekQuestionnaireMonitoringWithParameters: exception " + e.getMessage()); e.printStackTrace(); Assert.assertFalse(false); } log.info("testSaveKtekQuestionnaireMonitoringWithParameters: RESULT " + result); log.info("testSaveKtekQuestionnaireMonitoringWithParameters: END "); log.info("*************************************************************"); log.info(""); }
From source file:org.motechproject.mobile.core.dao.hibernate.GatewayRequestDAOImplTest.java
/** * Test of getByStatusAndSchedule method, of class GatewayRequestDAOImpl. *///w w w.jav a 2s .c o m @Ignore @Test public void testGetByStatusAndSchedule() { System.out.println("getByStatusAndSchedule"); List<GatewayRequest> expResult = new ArrayList<GatewayRequest>(); md4.setGatewayRequestDetails(grd4); md5.setGatewayRequestDetails(grd5); expResult.add(md4); expResult.add(md5); MStatus status = MStatus.FAILED; List result = mDDAO.getByStatusAndSchedule(status, schedule); Assert.assertFalse(result.isEmpty()); Assert.assertEquals(expResult.size(), result.size()); Assert.assertEquals(true, result.contains(md4)); Assert.assertEquals(true, result.contains(md5)); }
From source file:de.itsvs.cwtrpc.controller.AutowiredRemoteServiceGroupConfigTest.java
@Test public void testIsAcceptedServiceInterface7() { final AutowiredRemoteServiceGroupConfig config; config = new AutowiredRemoteServiceGroupConfig(); config.setBasePackages(Arrays.asList(new String[] { "de.itsvs.cwtrpc.controller.config." })); config.setIncludeFilters(Arrays.asList(new Pattern[] { PatternFactory.compile(PatternType.REGEX, MatcherType.PACKAGE, "de\\..+\\.TestService[13]"), PatternFactory.compile(PatternType.REGEX, MatcherType.PACKAGE, "de\\..+\\.TestService5") })); config.setExcludeFilters(Arrays.asList(new Pattern[] { PatternFactory.compile(PatternType.REGEX, MatcherType.PACKAGE, "de\\..+\\.TestService1") })); Assert.assertFalse(config.isAcceptedServiceInterface(TestService1.class)); Assert.assertFalse(config.isAcceptedServiceInterface(TestService2.class)); Assert.assertTrue(config.isAcceptedServiceInterface(TestService3.class)); Assert.assertTrue(config.isAcceptedServiceInterface(TestService5.class)); }
From source file:org.jasig.schedassist.impl.owner.SpringJDBCAvailableScheduleDaoImplTest.java
/** * //from w ww . ja v a 2 s . c o m * @throws Exception */ @Test public void testAddRemoveScheduleMultiples() throws Exception { Set<AvailableBlock> blocks = AvailableBlockBuilder.createBlocks("9:00 AM", "5:00 PM", "MWF", CommonDateOperations.parseDatePhrase("20091102"), CommonDateOperations.parseDatePhrase("20091127")); AvailableSchedule schedule = availableScheduleDao.addToSchedule(sampleOwners[0], blocks); SortedSet<AvailableBlock> stored = schedule.getAvailableBlocks(); Assert.assertEquals(12, stored.size()); Assert.assertTrue(stored.contains(AvailableBlockBuilder.createBlock("20091102-0900", "20091102-1700"))); Assert.assertTrue(stored.contains(AvailableBlockBuilder.createBlock("20091104-0900", "20091104-1700"))); Assert.assertTrue(stored.contains(AvailableBlockBuilder.createBlock("20091106-0900", "20091106-1700"))); Assert.assertTrue(stored.contains(AvailableBlockBuilder.createBlock("20091109-0900", "20091109-1700"))); Assert.assertTrue(stored.contains(AvailableBlockBuilder.createBlock("20091111-0900", "20091111-1700"))); Assert.assertTrue(stored.contains(AvailableBlockBuilder.createBlock("20091113-0900", "20091113-1700"))); Assert.assertTrue(stored.contains(AvailableBlockBuilder.createBlock("20091116-0900", "20091116-1700"))); Assert.assertTrue(stored.contains(AvailableBlockBuilder.createBlock("20091118-0900", "20091118-1700"))); Assert.assertTrue(stored.contains(AvailableBlockBuilder.createBlock("20091120-0900", "20091120-1700"))); Assert.assertTrue(stored.contains(AvailableBlockBuilder.createBlock("20091123-0900", "20091123-1700"))); Assert.assertTrue(stored.contains(AvailableBlockBuilder.createBlock("20091125-0900", "20091125-1700"))); Assert.assertTrue(stored.contains(AvailableBlockBuilder.createBlock("20091127-0900", "20091127-1700"))); schedule = availableScheduleDao.retrieve(sampleOwners[0]); stored = schedule.getAvailableBlocks(); Assert.assertTrue(stored.contains(AvailableBlockBuilder.createBlock("20091102-0900", "20091102-1700"))); Assert.assertTrue(stored.contains(AvailableBlockBuilder.createBlock("20091104-0900", "20091104-1700"))); Assert.assertTrue(stored.contains(AvailableBlockBuilder.createBlock("20091106-0900", "20091106-1700"))); Assert.assertTrue(stored.contains(AvailableBlockBuilder.createBlock("20091109-0900", "20091109-1700"))); Assert.assertTrue(stored.contains(AvailableBlockBuilder.createBlock("20091111-0900", "20091111-1700"))); Assert.assertTrue(stored.contains(AvailableBlockBuilder.createBlock("20091113-0900", "20091113-1700"))); Assert.assertTrue(stored.contains(AvailableBlockBuilder.createBlock("20091116-0900", "20091116-1700"))); Assert.assertTrue(stored.contains(AvailableBlockBuilder.createBlock("20091118-0900", "20091118-1700"))); Assert.assertTrue(stored.contains(AvailableBlockBuilder.createBlock("20091120-0900", "20091120-1700"))); Assert.assertTrue(stored.contains(AvailableBlockBuilder.createBlock("20091123-0900", "20091123-1700"))); Assert.assertTrue(stored.contains(AvailableBlockBuilder.createBlock("20091125-0900", "20091125-1700"))); Assert.assertTrue(stored.contains(AvailableBlockBuilder.createBlock("20091127-0900", "20091127-1700"))); // remove some blocks from the middle of a few days schedule = availableScheduleDao.removeFromSchedule(sampleOwners[0], AvailableBlockBuilder.createBlock("20091111-1200", "20091111-1300")); stored = schedule.getAvailableBlocks(); Assert.assertFalse(stored.contains(AvailableBlockBuilder.createBlock("20091111-0900", "20091111-1700"))); Assert.assertFalse(stored.contains(AvailableBlockBuilder.createBlock("20091111-1200", "20091111-1300"))); Assert.assertTrue(stored.contains(AvailableBlockBuilder.createBlock("20091111-0900", "20091111-1200"))); Assert.assertTrue(stored.contains(AvailableBlockBuilder.createBlock("20091111-1300", "20091111-1700"))); schedule = availableScheduleDao.removeFromSchedule(sampleOwners[0], AvailableBlockBuilder.createBlock("20091116-0900", "20091116-1200")); stored = schedule.getAvailableBlocks(); Assert.assertFalse(stored.contains(AvailableBlockBuilder.createBlock("20091116-0900", "20091116-1200"))); Assert.assertTrue(stored.contains(AvailableBlockBuilder.createBlock("20091116-1200", "20091116-1700"))); schedule = availableScheduleDao.removeFromSchedule(sampleOwners[0], AvailableBlockBuilder.createBlock("20091127-1600", "20091127-1800")); stored = schedule.getAvailableBlocks(); Assert.assertFalse(stored.contains(AvailableBlockBuilder.createBlock("20091127-0900", "20091127-1700"))); Assert.assertTrue(stored.contains(AvailableBlockBuilder.createBlock("20091127-0900", "20091127-1600"))); }
From source file:org.opencastproject.distribution.download.DownloadDistributionServiceImplTest.java
@Test public void testRetractByDistributed() throws Exception { int elementCount = mp.getElements().length; // Distribute the mediapackage and all of its elements Job job1 = service.distribute("engage-player", mp, "track-1"); Job job2 = service.distribute("engage-player", mp, "catalog-1"); Job job3 = service.distribute("engage-player", mp, "catalog-2"); Job job4 = service.distribute("engage-player", mp, "notes"); Job job5 = service.distribute("oai-pmh", mp, "notes"); JobBarrier jobBarrier = new JobBarrier(serviceRegistry, 500, job1, job2, job3, job4, job5); jobBarrier.waitForJobs();/*w w w.j a v a 2 s. co m*/ // Add the new elements to the mediapackage MediaPackageElement job1Element = MediaPackageElementParser.getFromXml(job1.getPayload()); mp.add(job1Element); MediaPackageElement job2Element = MediaPackageElementParser.getFromXml(job2.getPayload()); mp.add(job2Element); MediaPackageElement job3Element = MediaPackageElementParser.getFromXml(job3.getPayload()); mp.add(job3Element); MediaPackageElement job4Element = MediaPackageElementParser.getFromXml(job4.getPayload()); mp.add(job4Element); MediaPackageElement job5Element = MediaPackageElementParser.getFromXml(job5.getPayload()); mp.add(job5Element); File mpDir = new File(distributionRoot, PathSupport.path("engage-player", mp.getIdentifier().compact())); File mediaDir = new File(mpDir, "track-1"); File metadata1Dir = new File(mpDir, "catalog-1"); File metadata2Dir = new File(mpDir, "catalog-2"); File attachmentsDir = new File(mpDir, "notes"); Assert.assertTrue(mediaDir.exists()); Assert.assertTrue(metadata1Dir.exists()); Assert.assertTrue(metadata2Dir.exists()); Assert.assertTrue(attachmentsDir.exists()); Assert.assertTrue(new File(mediaDir, "media.mov").exists()); // the filenames are changed to reflect the element ID Assert.assertTrue(new File(metadata1Dir, "dublincore.xml").exists()); Assert.assertTrue(new File(metadata2Dir, "mpeg7.xml").exists()); Assert.assertTrue(new File(attachmentsDir, "attachment.txt").exists()); // Now retract the mediapackage and ensure that the distributed files have been removed Job job6 = service.retract("engage-player", mp, job1Element.getIdentifier()); Job job7 = service.retract("engage-player", mp, job2Element.getIdentifier()); Job job8 = service.retract("engage-player", mp, job3Element.getIdentifier()); Job job9 = service.retract("engage-player", mp, job4Element.getIdentifier()); jobBarrier = new JobBarrier(serviceRegistry, 500, job6, job7, job8, job9); jobBarrier.waitForJobs(); // Remove the distributed elements from the mediapackage mp.remove(MediaPackageElementParser.getFromXml(job6.getPayload())); mp.remove(MediaPackageElementParser.getFromXml(job7.getPayload())); mp.remove(MediaPackageElementParser.getFromXml(job8.getPayload())); mp.remove(MediaPackageElementParser.getFromXml(job9.getPayload())); // +1 since the oai-pmh distribution has not been retracted Assert.assertEquals(elementCount + 1, mp.getElements().length); Assert.assertNotNull(mp.getElementById("track-1")); Assert.assertNotNull(mp.getElementById("catalog-1")); Assert.assertNotNull(mp.getElementById("catalog-2")); Assert.assertNotNull(mp.getElementById("notes")); Assert.assertFalse(service.getDistributionFile("engage-player", mp, mp.getElementById("track-1")).isFile()); Assert.assertFalse( service.getDistributionFile("engage-player", mp, mp.getElementById("catalog-1")).isFile()); Assert.assertFalse( service.getDistributionFile("engage-player", mp, mp.getElementById("catalog-2")).isFile()); Assert.assertFalse(service.getDistributionFile("engage-player", mp, mp.getElementById("notes")).isFile()); Assert.assertTrue(service.getDistributionFile("oai-pmh", mp, mp.getElementById("notes")).isFile()); }