List of usage examples for junit.framework Assert assertTrue
static public void assertTrue(boolean condition)
From source file:com.connectsdk.service.sessions.WebOSWebAppSessionTest.java
@Test public void testNext() throws JSONException { ResponseListener<Object> listener = Mockito.mock(ResponseListener.class); session.next(listener);/*from w w w .j a v a 2s .co m*/ Robolectric.runUiThreadTasksIncludingDelayedTasks(); ArgumentCaptor<JSONObject> argPacket = ArgumentCaptor.forClass(JSONObject.class); ArgumentCaptor<JSONObject> argPayload = ArgumentCaptor.forClass(JSONObject.class); Mockito.verify(socket).sendMessage(argPacket.capture(), argPayload.capture()); Mockito.verify(listener).onSuccess(null); JSONObject packet = argPacket.getValue(); JSONObject payload = argPayload.getValue(); Assert.assertNull(payload); Assert.assertTrue(packet.has("payload")); Assert.assertEquals("playNext", packet.getJSONObject("payload").getJSONObject("mediaCommand").getString("type")); Assert.assertEquals("connectsdk.mediaCommand", packet.getJSONObject("payload").getString("contentType")); }
From source file:de.hybris.platform.acceleratorservices.order.strategies.impl.ReminderUncollectedConsignmentStrategyTest.java
@Test public void testProcessConsignmentOKNoBusinessProcessExists() { BDDMockito.given(consignmentModel.getShippingDate()) .willReturn(DateUtils.addHours(referenceDate, 0 - timeThreshold.intValue() - 1)); BDDMockito.given(businessProcessService.getProcess(Mockito.anyString())).willReturn(null); BDDMockito.given(businessProcessService.createProcess(Mockito.anyString(), Mockito.anyString())) .willReturn(consignmentProcessModel); reminderUncollectedConsignmentStrategy.processConsignment(consignmentModel); Assert.assertTrue(true); Mockito.verify(consignmentProcessModel).setConsignment(consignmentModel); Mockito.verify(modelService).save(consignmentProcessModel); Mockito.verify(businessProcessService).startProcess(consignmentProcessModel); }
From source file:ch.medshare.elexis_directories.TestElexisDirectories.java
@Test public void test_hamacher_bern() throws IOException { File base = get_ressource_path(); Assert.assertTrue(base.exists()); File to_test = new File(base, "hamacher_bern.html"); Assert.assertTrue(to_test.exists()); KontaktEntry juerg = new KontaktEntry("Jrg", "Hamacher", "rzte, Innere Medizin, Lungenkrankheiten (Pneumologie)", "Bremgartenstrasse 119", "3012", "Bern", "031 300 35 00", "", "", true); List<KontaktEntry> expectedKontakte = new ArrayList<KontaktEntry>(); KontaktEntry ellen = new KontaktEntry("Ellen", "Hamacher", "", "Kutscherweg 20", "3047", "Bremgarten b. Bern", "031 301 74 74", "", "", true); expectedKontakte.add(juerg);//from w w w. ja v a2 s .com expectedKontakte.add(ellen); compare_file_to_kontacts(to_test, expectedKontakte); }
From source file:de.hybris.platform.acceleratorservices.order.strategies.impl.CustomerServiceUncollectedConsignmentStrategyTest.java
@Test public void testProcessConsignmentOKNoBusinessProcessExists() { BDDMockito.given(consignmentModel.getShippingDate()) .willReturn(DateUtils.addHours(referenceDate, 0 - timeThreshold.intValue() - 1)); BDDMockito.given(businessProcessService.getProcess(Mockito.anyString())).willReturn(null); BDDMockito.given(businessProcessService.createProcess(Mockito.anyString(), Mockito.anyString())) .willReturn(consignmentProcessModel); customerServiceUncollectedConsignmentStrategy.processConsignment(consignmentModel); Assert.assertTrue(true); Mockito.verify(consignmentProcessModel).setConsignment(consignmentModel); Mockito.verify(modelService).save(consignmentProcessModel); Mockito.verify(businessProcessService).startProcess(consignmentProcessModel); }
From source file:es.tekniker.framework.ktek.questionnaire.mng.test.TestQuestionnaireMngServer.java
@org.junit.Test public void testSaveKtekQuestionnaireAssessment() { log.info("*************************************************************"); log.info("testSaveKtekQuestionnaireAssessment: START "); QuestionnaireMngServer manager = new QuestionnaireMngServer(); String result = TestDefines.RESULT_OK; Assert.assertTrue(true); String token = null;/*www .j a va 2s . c o m*/ int boolOK = 0; KtekQuestionnaireResultEntity resultData = null; try { token = TestData.getLoginToken(); resultData = es.tekniker.framework.ktek.questionnaire.mng.db.TestData .getKtekQuestionnaireAssessmentResultEntity1(); boolOK = manager.saveQuestionnaireModel(token, resultData); if (boolOK == 1) { log.info("testSaveKtekQuestionnaireAssessment: OK"); Assert.assertTrue(true); } else { log.error("testSaveKtekQuestionnaireAssessment: ERROR "); result = TestDefines.RESULT_ERROR; Assert.assertTrue(false); } } catch (KtekExceptionEntity e) { log.error("testSaveKtekQuestionnaireAssessment: Exception " + e.getMessage()); e.printStackTrace(); result = TestDefines.RESULT_EXCEPTION; Assert.assertTrue(false); } log.info("testSaveKtekQuestionnaireAssessment: RESULT " + result); log.info("testSaveKtekQuestionnaireAssessment: END "); log.info("*************************************************************"); log.info(""); }
From source file:eagle.storage.jdbc.TestJdbcStorage.java
public void testWrite() throws IOException { List<TestTimeSeriesAPIEntity> entityList = new ArrayList<TestTimeSeriesAPIEntity>(); int i = 0;/* w w w. ja v a 2s . c om*/ while (i++ < 1000) { entityList.add(newInstance()); } ModifyResult<String> result = storage.create(entityList, entityDefinition); Assert.assertTrue(result.getSize() > 0); }
From source file:com.feedzai.fos.impl.weka.WekaScorerTest.java
@Test public void passthroughCreationTest() throws FOSException { BaseConfiguration configuration = new BaseConfiguration(); configuration.setProperty(GenericObjectPoolConfig.class.getName() + ".minIdle", 10); configuration.setProperty(GenericObjectPoolConfig.class.getName() + ".maxActive", 10); configuration.setProperty(FosConfig.HEADER_LOCATION, "target/test-classes/models/threadunsafe"); configuration.setProperty(FosConfig.FACTORY_NAME, WekaManagerFactory.class.getName()); WekaManagerConfig wekaManagerConfig = new WekaManagerConfig(new FosConfig(configuration)); WekaManager wekaManager = new WekaManager(wekaManagerConfig); WekaScorer wekaScorer = wekaManager.getScorer(); double[] score = wekaScorer.score(Lists.newArrayList(testUUID), new Object[] { 1.5, 0, "gray", "positive" }) .get(0);//from ww w . j ava 2 s . co m assertEquals(2, score.length); assertEquals(1.0, score[0] + score[1], 0.001); Assert.assertTrue(((Map<Integer, WekaThreadSafeScorer>) Whitebox.getInternalState(wekaScorer, "wekaThreadSafeScorers")).get(testUUID) instanceof WekaThreadSafeScorerPassthrough); }
From source file:es.tekniker.framework.ktek.commons.mng.server.test.TestCommonsMngServer.java
public void testIsTokenValid() { log.info("*************************************************************"); log.info("testIsTokenValid: START "); CommonsMngServer mng = new CommonsMngServer(); String result = TestDefines.RESULT_OK; String token = ""; int idUser = 2; boolean boolValid; try {/*from w ww . j a v a2 s.c o m*/ token = getToken4IdUser(idUser); boolValid = mng.isTokenValid(token); if (boolValid) { log.info("testIsTokenValid: Token Valid "); Assert.assertTrue(true); } else { log.error("testIsTokenValid: Token NO Valid "); Assert.assertTrue(false); result = TestDefines.RESULT_ERROR; } } catch (KtekExceptionEntity e) { e.printStackTrace(); log.error("testIsTokenValid EXCEPTION: " + e.getMessage()); Assert.assertTrue(false); result = TestDefines.RESULT_EXCEPTION; } log.info("testIsTokenValid: RESULT " + result); log.info("testIsTokenValid: END "); log.info("*************************************************************"); log.info(""); }
From source file:org.mayocat.theme.ThemeDefinitionTest.java
@Test public void testParseTypes() throws Exception { String themeConfig = Resources.toString(Resources.getResource("theme-with-types.yml"), Charsets.UTF_8); ThemeDefinition theme = mapper.readValue(themeConfig, ThemeDefinition.class); Assert.assertTrue(theme.getProductTypes().size() > 0); TypeDefinition typeShirt = theme.getProductTypes().get("shirt"); Assert.assertNotNull(typeShirt);//from w w w .ja v a 2s .c o m Assert.assertEquals("T-Shirt", typeShirt.getName()); FeatureDefinition colorFeature = typeShirt.getFeatures().get("color"); Assert.assertNotNull(colorFeature); Assert.assertEquals("Color", colorFeature.getName()); Assert.assertEquals(0, colorFeature.getKeys().size()); Assert.assertEquals(0, colorFeature.getAddons().size()); FeatureDefinition sizeFeature = typeShirt.getFeatures().get("size"); Assert.assertNotNull(sizeFeature); Assert.assertEquals("Size", sizeFeature.getName()); Assert.assertEquals(3, sizeFeature.getKeys().size()); Assert.assertEquals(1, sizeFeature.getAddons().size()); VariantsDefinition variants = typeShirt.getVariants(); Assert.assertEquals(3, variants.getProperties().size()); Assert.assertEquals(1, variants.getAddons().size()); }
From source file:org.jrecruiter.service.UserServiceTest.java
@Test public void testPasswordEncoder() { boolean expectation = passwordEncoder.isPasswordValid( "ccWyzbWK1zdTgCy3pz28mN/VE3SSLvblaolK2znAoTGZ00zLHs61ZxemLc1YrlLIBvgbMWi7x3fxg7AdtwCxr8HxiBunE5hX/o9JuGbcm/w=", "jrecruiter", null); Assert.assertTrue(expectation); }