List of usage examples for junit.framework Assert assertFalse
static public void assertFalse(boolean condition)
From source file:es.tekniker.framework.ktek.questionnaire.mng.server.test.TestQuestionnaireMngServer.java
@org.junit.Test public void testGetQuestionnaires4TypeMonitoringActivityFilter() { log.info("*************************************************************"); log.info("testGetQuestionnaires4TypeMonitoringActivityFilter: START "); String result = TestDefines.RESULT_OK; String token = null;/*from w ww. ja v a 2s . c o m*/ int idlang = 1; List<KtekResultQuestionnaireItemsEntity> array = null; boolean all = false; long datefrom = (long) 1420113600000.0; long dateto = (long) 1451649600000.0; int orderby = 2; String codtelecareprogram = "BD"; try { token = "token1"; DrugTreatmentMngServer objMngServer = new DrugTreatmentMngServer(); List<KtekQuestionnaireItemFilterEntity> list = objMngServer .getQuestionnaires4TypeMonitoringActivityFilter(token, idlang, codtelecareprogram, all, datefrom, dateto, orderby); if (list != null) { log.info("testGetQuestionnaires4TypeMonitoringActivityFilter: list is NOT NULL " + list.size()); Assert.assertTrue(true); } else { log.error("testGetQuestionnaires4TypeMonitoringActivityFilter: list is NULL "); result = TestDefines.RESULT_ERROR; Assert.assertTrue(true); } } catch (KtekExceptionEntity e) { System.out.println("testGetQuestionnaires4TypeMonitoringActivityFilter: exception " + e.getMessage()); e.printStackTrace(); Assert.assertFalse(false); } log.info("testGetQuestionnaires4TypeMonitoringActivityFilter: RESULT " + result); log.info("testGetQuestionnaires4TypeMonitoringActivityFilter: END "); log.info("*************************************************************"); log.info(""); }
From source file:com.test.onesignal.MainOneSignalClassRunner.java
@Test public void testDeleteTagsAfterSync() throws Exception { OneSignalInit();//from ww w . ja va 2 s . c o m OneSignal.sendTags("{\"foo\": \"bar\", \"fuz\": \"baz\"}"); threadAndTaskWait(); Assert.assertEquals("bar", ShadowOneSignalRestClient.lastPost.getJSONObject("tags").get("foo")); Assert.assertEquals("baz", ShadowOneSignalRestClient.lastPost.getJSONObject("tags").get("fuz")); OneSignal.deleteTags("[\"foo\", \"fuz\"]"); threadAndTaskWait(); Assert.assertEquals("", ShadowOneSignalRestClient.lastPost.getJSONObject("tags").get("foo")); Assert.assertEquals("", ShadowOneSignalRestClient.lastPost.getJSONObject("tags").get("fuz")); GetTags(); Assert.assertNull(lastGetTags); final SharedPreferences prefs = blankActivity.getSharedPreferences(OneSignal.class.getSimpleName(), Context.MODE_PRIVATE); JSONObject syncValues = new JSONObject( prefs.getString("ONESIGNAL_USERSTATE_SYNCVALYES_CURRENT_STATE", null)); Assert.assertFalse(syncValues.has("tags")); }
From source file:com.test.onesignal.MainOneSignalClassRunner.java
@Test public void testOmitDeletesOfNonExistingKeys() throws Exception { OneSignalInit();// www.j av a2s . com OneSignal.deleteTag("this_key_does_not_exist"); threadAndTaskWait(); Assert.assertFalse(ShadowOneSignalRestClient.lastPost.has("tags")); }
From source file:es.tekniker.framework.ktek.questionnaire.mng.server.test.TestQuestionnaireMngServer.java
@org.junit.Test public void testGetQuestionnaireModelWithResults() { log.info("*************************************************************"); log.info("testGetQuestionnaireModelWithResults: START "); String result = TestDefines.RESULT_OK; QuestionnaireMngServer manager = new QuestionnaireMngServer(); String token = null;//w w w. ja va 2 s. c om int idlang = 1; int idresultquestionnaire = 161; KtekQuestionnaireModelEntity instance = null; String codtelecareprogram = "TBP1"; try { token = TestData.getLoginToken(); instance = manager.getQuestionnaireModelWithResults(token, idlang, codtelecareprogram, idresultquestionnaire); if (instance != null) { log.info("testGetQuestionnaireModelWithResults: instanc is NOT NULL "); Assert.assertTrue(true); } else { log.error("testGetQuestionnaireModelWithResults: instance is NULL "); result = TestDefines.RESULT_ERROR; Assert.assertTrue(true); } } catch (KtekExceptionEntity e) { System.out.println("testGetQuestionnaireModelWithResults: exception " + e.getMessage()); e.printStackTrace(); Assert.assertFalse(false); } log.info("testGetQuestionnaireModelWithResults: RESULT " + result); log.info("testGetQuestionnaireModelWithResults: END "); log.info("*************************************************************"); log.info(""); }
From source file:es.tekniker.framework.ktek.questionnaire.mng.server.test.TestQuestionnaireMngServer.java
@org.junit.Test public void testGetQuestionnaires4TypeMonitoringActivityPlanned() { log.info("*************************************************************"); log.info("testGetQuestionnaires4TypeMonitoringActivityPlanned: START "); String result = TestDefines.RESULT_OK; QuestionnaireMngServer manager = new QuestionnaireMngServer(); short status = KtekQuestionnaireStatus.QUESTIONNAIRE_STATUS_PENDING; int idlang = 1; String codtelecareprogram = "TBP1"; String codUser = "User1"; try {//from w ww .j a va 2s. c o m List<KtekQuestionnaireModelEntity> list = manager.getQuestionnaires4TypeMonitoringActivityPlanned( idlang, KtekApplicationitemType.DRUGFOLLOWUP, codUser, codtelecareprogram, status); if (list != null) { log.info("testGetQuestionnaires4TypeMonitoringActivityPlanned: instanc is NOT NULL "); Assert.assertTrue(true); } else { log.error("testGetQuestionnaires4TypeMonitoringActivityPlanned: instance is NULL "); result = TestDefines.RESULT_ERROR; Assert.assertTrue(false); } } catch (Exception e) { System.out.println("testGetQuestionnaires4TypeMonitoringActivityPlanned: exception " + e.getMessage()); e.printStackTrace(); Assert.assertFalse(false); } log.info("testGetQuestionnaires4TypeMonitoringActivityPlanned: RESULT " + result); log.info("testGetQuestionnaires4TypeMonitoringActivityPlanned: END "); log.info("*************************************************************"); log.info(""); }
From source file:com.ebay.cloud.cms.query.service.QueryPaginationByIdTest.java
/** * limit for embed version//from w w w .j a va 2s . c o m * * hint for embed */ @Test public void testQueryIterLimit02_embed() { String query = "Manifest.versions{*}"; QueryContext qc = newQueryContext(DEPLOY_REPO, IBranch.DEFAULT_BRANCH); qc.setPaginationMode(PaginationMode.ID_BASED); qc.setAllowFullTableScan(true); qc.getCursor().setLimits(new int[] { 1, 0 }); int hint = 1; qc.getCursor().setHint(hint); qc.setSourceIP("127.0.0.1"); IQueryResult result = queryService.query(query, qc); Assert.assertEquals(2, result.getEntities().size()); Assert.assertFalse(result.hasMoreResults()); Assert.assertNull(result.getNextCursor()); }
From source file:com.ebay.cloud.cms.query.service.QueryPaginationByIdTest.java
@Test public void testQueryIterLimit03_embed() { String query = "Manifest.versions{*}"; QueryContext qc = newQueryContext(DEPLOY_REPO, IBranch.DEFAULT_BRANCH); qc.setPaginationMode(PaginationMode.ID_BASED); qc.setAllowFullTableScan(true);/*from ww w . j ava2 s . co m*/ qc.getCursor().setLimits(new int[] { 0 }); qc.setSourceIP("127.0.0.1"); IQueryResult result = queryService.query(query, qc); Assert.assertFalse(result.hasMoreResults()); }
From source file:es.tekniker.framework.ktek.questionnaire.mng.server.test.TestQuestionnaireMngServer.java
@org.junit.Test public void testGetQuestionnaireitemList4QuestionnairePlannedFinished() { log.info("*************************************************************"); log.info("testGetQuestionnaireitemList4QuestionnairePlannedFinished: START "); String result = TestDefines.RESULT_OK; String coduser = "user1"; short[] typeMonitoringActivityArray; String codtelecareprogram = "TBP1"; try {/*from ww w .j av a 2s . c om*/ typeMonitoringActivityArray = new short[1]; typeMonitoringActivityArray[0] = 1; QuestionnaireMngServer objMngServer = new QuestionnaireMngServer(); Ktek_questionnaireitem[] array = objMngServer.getQuestionnaireitemList4QuestionnairePlannedFinished( coduser, typeMonitoringActivityArray, codtelecareprogram); if (array != null) { log.info("testGetQuestionnaireitemList4QuestionnairePlannedFinished: instanc is NOT NULL "); Assert.assertTrue(true); } else { log.error("testGetQuestionnaireitemList4QuestionnairePlannedFinished: instance is NULL "); result = TestDefines.RESULT_ERROR; Assert.assertTrue(false); } } catch (Exception e) { System.out.println( "testGetQuestionnaireitemList4QuestionnairePlannedFinished: exception " + e.getMessage()); e.printStackTrace(); Assert.assertFalse(false); } log.info("testGetQuestionnaireitemList4QuestionnairePlannedFinished: RESULT " + result); log.info("testGetQuestionnaireitemList4QuestionnairePlannedFinished: END "); log.info("*************************************************************"); log.info(""); }
From source file:com.linkedin.pinot.core.data.manager.realtime.LLRealtimeSegmentDataManagerTest.java
@Test public void testReuseOfBuiltSegment() throws Exception { FakeLLRealtimeSegmentDataManager segmentDataManager = createFakeSegmentManager(); SegmentCompletionProtocol.Response.Params params = new SegmentCompletionProtocol.Response.Params(); params.withStatus(SegmentCompletionProtocol.ControllerResponseStatus.COMMIT_SUCCESS); SegmentCompletionProtocol.Response commitSuccess = new SegmentCompletionProtocol.Response(params); params.withStatus(SegmentCompletionProtocol.ControllerResponseStatus.FAILED); SegmentCompletionProtocol.Response commitFailed = new SegmentCompletionProtocol.Response(params); // Set up the responses so that we get a failed respnse first and then a success response. segmentDataManager._responses.add(commitFailed); segmentDataManager._responses.add(commitSuccess); final long leaseTime = 50000L; // The first time we invoke build, it should go ahead and build the segment. String segTarFileName = segmentDataManager.invokeBuildForCommit(leaseTime); Assert.assertTrue(segmentDataManager._buildSegmentCalled); Assert.assertFalse(segmentDataManager.invokeCommit(segTarFileName)); Assert.assertTrue(new File(segTarFileName).exists()); segmentDataManager._buildSegmentCalled = false; // This time around it should not build the segment. String segTarFileName1 = segmentDataManager.invokeBuildForCommit(leaseTime); Assert.assertFalse(segmentDataManager._buildSegmentCalled); Assert.assertEquals(segTarFileName1, segTarFileName); Assert.assertTrue(new File(segTarFileName).exists()); Assert.assertTrue(segmentDataManager.invokeCommit(segTarFileName1)); Assert.assertFalse(new File(segTarFileName).exists()); }
From source file:org.openmrs.module.paperrecord.PaperRecordServiceComponentTest.java
@Test public void testMarkPapersRecordForMergeShouldCreatePaperRecordMergeRequest() throws Exception { Patient patient1 = patientService.getPatient(2); Patient patient2 = patientService.getPatient(6); Location paperRecordLocation = locationService.getLocation(1); // create a couple paper records PaperRecord paperRecord1 = paperRecordService.createPaperRecord(patient1, paperRecordLocation); PaperRecord paperRecord2 = paperRecordService.createPaperRecord(patient2, paperRecordLocation); paperRecordService.markPaperRecordsForMerge(paperRecord1, paperRecord2); Assert.assertEquals(1, paperRecordService.getOpenPaperRecordMergeRequests(paperRecordLocation).size()); PaperRecordMergeRequest request = paperRecordService.getOpenPaperRecordMergeRequests(paperRecordLocation) .get(0);//from w ww. j av a 2s .co m Assert.assertEquals(paperRecord1, request.getPreferredPaperRecord()); Assert.assertEquals(paperRecord2, request.getNotPreferredPaperRecord()); Assert.assertEquals(PaperRecordMergeRequest.Status.OPEN, request.getStatus()); Assert.assertNotNull(request.getDateCreated()); Assert.assertEquals(Context.getAuthenticatedUser(), request.getCreator()); Assert.assertFalse(paperRecord1.getPatientIdentifier().isVoided()); Assert.assertTrue(paperRecord2.getPatientIdentifier().isVoided()); }