List of usage examples for junit.framework Assert assertTrue
static public void assertTrue(boolean condition)
From source file:de.itsvs.cwtrpc.controller.config.RemoteServiceControllerConfigBeanDefinitionParserTest.java
@Test public void test4() { RemoteServiceControllerConfig config; config = appContext.getBean("serviceController103", RemoteServiceControllerConfig.class); Assert.assertTrue(config.getRpcTokenProtectionEnabled()); }
From source file:es.tekniker.framework.ktek.questionnaire.mng.server.test.TestQuestionnaireMngServer.java
public void testLoadFile() { log.info("*************************************************************"); log.info("testLoadFile: START "); QuestionnaireMngServer mng = new QuestionnaireMngServer(); String result = TestDefines.RESULT_OK; boolean boolValid = false; String strfilename = null;//from w w w .jav a 2 s.c om try { strfilename = "D:\\Proyectos\\FI-STAR\\code\\subversion\\trunk\\backend\\db\\dataLoadQuestionnaire_QSE.csv"; boolValid = mng.loadfileData(strfilename); if (boolValid) { log.info("testLoadFile: Token Valid "); Assert.assertTrue(true); } else { log.error("testLoadFile: Token NO Valid "); Assert.assertTrue(false); result = TestDefines.RESULT_ERROR; } } catch (Exception e) { e.printStackTrace(); log.error("testLoadFile EXCEPTION: " + e.getMessage()); Assert.assertTrue(false); result = TestDefines.RESULT_EXCEPTION; } log.info("testLoadFile: RESULT " + result); log.info("testLoadFile: END "); log.info("*************************************************************"); log.info(""); }
From source file:com.exxonmobile.ace.hybris.facades.suggestion.impl.DefaultSimpleSuggestionFacadeTest.java
@Test public void testGetReferencedProductsForBoughtCategory() { final UserModel user = mock(UserModel.class); final CategoryModel category = mock(CategoryModel.class); final String categoryCode = "code"; given(categoryService.getCategoryForCode(categoryCode)).willReturn(category); final Integer limit = NumberUtils.INTEGER_ONE; final boolean excludeBoughtProducts = true; final ProductReferenceTypeEnum type = ProductReferenceTypeEnum.FOLLOWUP; given(userService.getCurrentUser()).willReturn(user); given(simpleSuggestionService.getReferencesForPurchasedInCategory(category, user, type, excludeBoughtProducts, limit)).willReturn(Collections.singletonList(productModel)); given(productConverter.convert(productModel)).willReturn(productData); final List<ProductData> result = defaultSimpleSuggestionFacade .getReferencesForPurchasedInCategory(categoryCode, type, excludeBoughtProducts, limit); Assert.assertTrue(result.contains(productData)); BDDMockito.verify(productPricePopulator, BDDMockito.times(1)).populate(productModel, productData); BDDMockito.verify(productPrimaryImagePopulator, BDDMockito.times(1)).populate(productModel, productData); }
From source file:com.impetus.kundera.EntityManagerImplTest.java
@Test public void testSingleEntityCRUD_EmCleared() { // Persist/*from w w w.j a va2s .c o m*/ final SampleEntity entity = new SampleEntity(); entity.setKey(1); entity.setName("Amry"); entity.setCity("Delhi"); em.persist(entity); Assert.assertTrue(em.contains(entity)); em.clear(); Assert.assertFalse(em.contains(entity)); SampleEntity found = em.find(SampleEntity.class, 1, new HashMap<String, Object>()); assertSampleEntity(found); found.setName("Xamry"); found.setCity("Noida"); em.clear(); em.merge(found); SampleEntity foundAfterMerge = em.find(SampleEntity.class, 1); assertUpdatedSampleEntity(foundAfterMerge); // Modify record in dummy database directly SampleEntity se = (SampleEntity) DummyDatabase.INSTANCE.getSchema("KunderaTest").getTable("table") .getRecord(new Integer(1)); se.setCity("Singapore"); em.refresh(foundAfterMerge); SampleEntity found2 = em.find(SampleEntity.class, 1); Assert.assertEquals("Singapore", found2.getCity()); em.detach(foundAfterMerge); em.clear(); found = em.find(SampleEntity.class, 1); em.remove(found); em.clear(); SampleEntity foundAfterDeletion = em.find(SampleEntity.class, 1); Assert.assertNull(foundAfterDeletion); }
From source file:com.buddycloud.mediaserver.download.DownloadImageTest.java
@Test public void downloadImageParamAuth() throws Exception { Base64 encoder = new Base64(true); String authStr = BASE_USER + ":" + BASE_TOKEN; ClientResource client = new ClientResource(URL + "?auth=" + new String(encoder.encode(authStr.getBytes()))); File file = new File(TEST_OUTPUT_DIR + File.separator + "downloaded.jpg"); FileOutputStream outputStream = FileUtils.openOutputStream(file); client.get().write(outputStream);//from w w w . ja v a 2 s .c o m Assert.assertTrue(file.exists()); // Delete downloaded file FileUtils.deleteDirectory(new File(TEST_OUTPUT_DIR)); outputStream.close(); }
From source file:com.buddycloud.mediaserver.download.DownloadVideoTest.java
@Test public void downloadVideoParamAuth() throws Exception { Base64 encoder = new Base64(true); String authStr = BASE_USER + ":" + BASE_TOKEN; ClientResource client = new ClientResource(URL + "?auth=" + new String(encoder.encode(authStr.getBytes()))); File file = new File(TEST_OUTPUT_DIR + File.separator + "downloaded.avi"); FileOutputStream outputStream = FileUtils.openOutputStream(file); client.get().write(outputStream);/* w w w . j a v a 2s . c om*/ Assert.assertTrue(file.exists()); // Delete downloaded file FileUtils.deleteDirectory(new File(TEST_OUTPUT_DIR)); outputStream.close(); }
From source file:org.ocpsoft.rewrite.prettyfaces.encoding.URLEncodingTest.java
@Test public void testNonMappedRequestRendersRewrittenURL() throws Exception { HttpAction<HttpGet> action = get("/encoding.jsf"); Assert.assertTrue(action.getCurrentURL().endsWith("/encoding.jsf")); Assert.assertTrue(action.getResponseContent().contains("/custom/form")); }
From source file:io.seldon.recommendation.VariationTestingClientStrategyTest.java
@Test public void rangeTest() { BigDecimal ratioTotal = new BigDecimal(1.0); BigDecimal currentMax = new BigDecimal(0.0); BigDecimal r1 = new BigDecimal(0.9); BigDecimal r2 = new BigDecimal(0.1); NumberRange range1 = new NumberRange(currentMax, currentMax.add(r1.divide(ratioTotal, 5, BigDecimal.ROUND_UP))); currentMax = currentMax.add(r1);/*w w w . j av a 2 s. co m*/ NumberRange range2 = new NumberRange(currentMax.add(new BigDecimal(0.0001)), currentMax.add(r2.divide(ratioTotal, 5, BigDecimal.ROUND_UP))); BigDecimal t = new BigDecimal(0.900001); Assert.assertTrue(range1.containsNumber(t)); Assert.assertFalse(range2.containsNumber(t)); BigDecimal t2 = new BigDecimal(0.901); Assert.assertFalse(range1.containsNumber(t2)); Assert.assertTrue(range2.containsNumber(t2)); }
From source file:at.tfr.securefs.process.ProcessFilesTest.java
@Test(expected = SecureFSError.class) public void overwriteExistingFileProhibited() throws Exception { // Given: the target directory AND file(!), the source file toFilesPath = Files.createDirectories(toRoot.resolve(DATA_FILES)); final String data = "Hallo Echo"; try (OutputStream os = cp.getEncrypter(fromFile)) { IOUtils.write(data, os);/*from www .j a v a 2 s . c om*/ } Files.copy(fromFile, targetToFile); Assert.assertTrue(Files.exists(targetToFile)); ProcessFilesData cfd = new ProcessFilesData().setFromRootPath(fromRoot.toString()) .setToRootPath(toRoot.toString()).setUpdate(false).setProcessActive(true); // When: copy of source file to toRoot ProcessFilesBean pf = new ProcessFilesBean(new MockSecureFsCache()); pf.copy(fromFile, fromRoot.getNameCount(), toRoot, cp, newSecret, cfd); // Then: Exception overwrite not allowed!! }
From source file:com.vmware.identity.sts.auth.impl.BETAuthenticatorTest.java
@Test public void testAuthCompleted() { final RequestSecurityTokenType rst = newValidRst(); final byte[] initRawLeg = Base64.decodeBase64(rst.getBinaryExchange().getValue()); com.vmware.identity.sts.idm.Authenticator idmAuth = EasyMock .createMock(com.vmware.identity.sts.idm.Authenticator.class); final PrincipalId principalId = new PrincipalId("user", "acme.com"); final GSSResult gssResult = new GSSResult(rst.getContext(), principalId); EasyMock.expect(idmAuth.authenticate(EasyMock.eq(rst.getContext()), EasyMock.aryEq(initRawLeg))) .andReturn(gssResult);// www .j a v a2s. co m EasyMock.replay(idmAuth); final Authenticator authenticator = new BETAuthenticator(idmAuth); final Result result = authenticator.authenticate(newReq(rst)); Assert.assertNotNull(result); Assert.assertTrue(result.completed()); Assert.assertEquals(principalId, result.getPrincipalId()); Assert.assertEquals(AuthnMethod.KERBEROS, result.getAuthnMethod()); EasyMock.verify(idmAuth); }