List of usage examples for junit.framework Assert assertTrue
static public void assertTrue(boolean condition)
From source file:es.tekniker.framework.ktek.commons.mng.db.test.TestCommonsManagerDB.java
@org.junit.Test public void testGetText() { log.info("*************************************************************"); log.info("testGetText: START "); CommonsManagerDB db = new CommonsManagerDB(); String result = TestDefines.RESULT_OK; String key = ""; int id = 1;//from w w w.jav a2s . c om int lang = 1; String instance = db.getText(key, id, lang); if (instance != null) { log.info("testGetText: Text value is " + instance); Assert.assertTrue(true); } else { log.error("testGetText: Text is NULL " + instance); Assert.assertTrue(false); result = TestDefines.RESULT_ERROR; } log.info("testGetText: RESULT " + result); log.info("testGetText: END "); log.info("*************************************************************"); log.info(""); }
From source file:com.sforce.cd.apexUnit.report.ApexReportGeneratorTest.java
@Test public void generateTestReportTest() { TestStatusPollerAndResultHandler queryPollerAndResultHandler = new TestStatusPollerAndResultHandler(); Long justBeforeReportGeneration = System.currentTimeMillis(); ApexReportBean[] apexReportBeans = queryPollerAndResultHandler.fetchResultsFromParentJobId(parentJobId, conn);/*from w w w. j a va 2 s .c o m*/ CodeCoverageComputer toolingAPIInvoker = new CodeCoverageComputer(); ApexClassCodeCoverageBean[] apexClassCodeCoverageBeans = toolingAPIInvoker .calculateAggregatedCodeCoverageUsingToolingAPI(); String reportFileName = "ApexUnitReport.xml"; ApexUnitTestReportGenerator.generateTestReport(apexReportBeans, reportFileName); File reportFile = new File(reportFileName); LOG.info("justBeforeReportGeneration: " + justBeforeReportGeneration); LOG.info("reportFile last modified..: " + reportFile.lastModified()); LOG.info("Result:" + FileUtils.isFileNewer(reportFile, justBeforeReportGeneration)); Assert.assertTrue(FileUtils.isFileNewer(reportFile, justBeforeReportGeneration)); }
From source file:core.service.test.executor.remote.TestRemoteServiceExecutor.java
@Test(timeout = 60000) public void testExecute() throws SecurityException, NoSuchMethodException { RemoteServiceExecutor executor = new RemoteServiceExecutor(); Method add = MathService.class.getMethod("add", Integer.class, Integer.class); ServiceRequestImpl request = new ServiceRequestImpl(); request.setArguments(new Object[] { 2, 2 }); request.setParamTypes(new Class[] { Integer.class, Integer.class }); request.setMethodName("add"); request.setServiceInterfaceClassName(MathService.class.getName()); ServiceResult result = executor.execute(request); Assert.assertTrue(result.isSuccess()); Assert.assertEquals(4, result.getPayload()); }
From source file:com.redhat.demo.CrmTest.java
/** * HTTP GET http://localhost:8181/cxf/crm/customerservice/customers/123 * returns the XML document representing customer 123 * <p/>//from ww w. j a v a2 s .c o m * On the server side, it matches the CustomerService's getCustomer() method * * @throws Exception */ @Test public void getCustomerTest() throws Exception { LOG.info("Sent HTTP GET request to query customer info"); url = new URL(CUSTOMER_TEST_URL); InputStream in = null; try { in = url.openStream(); } catch (IOException e) { LOG.error("Error connecting to {}", CUSTOMER_TEST_URL); LOG.error( "You should build the 'rest' quick start and deploy it to a local Fabric8 before running this test"); LOG.error("Please read the README.md file in 'rest' quick start root"); Assert.fail("Connection error"); } String res = getStringFromInputStream(in); LOG.info(res); Assert.assertTrue(res.contains("123")); }
From source file:example.crm.CrmIT.java
/** * HTTP GET http://localhost:9003/customers/123 returns the JSON document representing customer 123 * <p/>/*from w w w .ja va 2 s .c om*/ * On the server side, it matches the CustomerService's getCustomer() method * */ @Test public void getCustomerTest() throws Exception { LOG.info("Sent HTTP GET request to query customer info"); url = new URL(CUSTOMER_TEST_URL); InputStream in = null; try { in = url.openStream(); } catch (IOException e) { LOG.error("Error connecting to {}", CUSTOMER_TEST_URL); LOG.error( "You should build the 'camel-netty4-http' quick start and deploy it to a local Fabric8 before running this test"); LOG.error("Please read the README.md file in 'camel-netty4-http' quick start root"); Assert.fail("Connection error"); } String res = getStringFromInputStream(in); LOG.info(res); Assert.assertTrue(res.contains("123")); }
From source file:org.jasig.ssp.util.importer.job.BatchInitializerTest.java
@Test public void testRemoveStaleFiles() throws Exception { deleteDirectory(processDirectoryPath); deleteDirectory(upsertDirectoryPath); createFiles(processDirectoryPath);/* ww w . ja v a2 s. c o m*/ createFiles(upsertDirectoryPath); createFiles(inputDirectoryPath); Assert.assertTrue(directoryExists(processDirectoryPath)); Assert.assertTrue(directoryExists(upsertDirectoryPath)); Assert.assertTrue(directoryExists(inputDirectoryPath)); Assert.assertTrue(directoryContainsFiles(inputDirectoryPath, 2)); Assert.assertTrue(directoryContainsFiles(upsertDirectoryPath, 2)); Assert.assertTrue(directoryContainsFiles(processDirectoryPath, 2)); BatchStatus status = jobLauncherTestUtils.launchJob().getStatus(); Assert.assertTrue(directoryExists(processDirectoryPath)); Assert.assertTrue(directoryExists(upsertDirectoryPath)); Assert.assertTrue(directoryExists(inputDirectoryPath)); Assert.assertTrue(directoryContainsFiles(processDirectoryPath, 2)); Assert.assertTrue(directoryContainsFiles(upsertDirectoryPath, 0)); Assert.assertTrue(directoryContainsFiles(inputDirectoryPath, 0)); Assert.assertEquals(BatchStatus.COMPLETED, status); }
From source file:azkaban.crypto.DecryptionTest.java
@Test public void testInvalidParams() throws IOException { BasicConfigurator.configure();//from ww w. j a v a 2 s. c o m Logger.getRootLogger().setLevel(Level.DEBUG); String expected = "test"; String[] cipheredtexts = { "eyJ2ZXIiOiIxLjAiLCJ2YWwiOiJOd1hRejdOMjBXUU05SXEzaE94RVZnPT0ifQ==", null, "" }; String[] passphrases = { "test1234", null, "" }; for (String cipheredtext : cipheredtexts) { for (String passphrase : passphrases) { Crypto crypto = new Crypto(); if (!StringUtils.isEmpty(cipheredtext) && !StringUtils.isEmpty(passphrase)) { String actual = crypto.decrypt(cipheredtext, passphrase); Assert.assertEquals(expected, actual); } else { try { crypto.decrypt(cipheredtext, passphrase); Assert.fail("Encyption should have failed with invalid parameters. cipheredtext: " + cipheredtext + " , passphrase: " + passphrase); } catch (Exception e) { Assert.assertTrue(e instanceof IllegalArgumentException); } } } } }
From source file:SdkUnitTests.java
@Test public void LoginTest() { ApiClient apiClient = new ApiClient(); apiClient.setBasePath(BaseUrl);// w w w . j a v a2 s . co m String creds = createAuthHeaderCreds(UserName, Password, IntegratorKey); apiClient.addDefaultHeader("X-DocuSign-Authentication", creds); Configuration.setDefaultApiClient(apiClient); try { AuthenticationApi authApi = new AuthenticationApi(); AuthenticationApi.LoginOptions loginOps = authApi.new LoginOptions(); loginOps.setApiPassword("true"); loginOps.setIncludeAccountIdGuid("true"); LoginInformation loginInfo = authApi.login(loginOps); Assert.assertNotSame(null, loginInfo); Assert.assertNotNull(loginInfo.getLoginAccounts()); Assert.assertTrue(loginInfo.getLoginAccounts().size() > 0); List<LoginAccount> loginAccounts = loginInfo.getLoginAccounts(); Assert.assertNotNull(loginAccounts.get(0).getAccountId()); System.out.println("LoginInformation: " + loginInfo); } catch (ApiException ex) { System.out.println("Exception: " + ex); } }
From source file:com.google.gct.idea.appengine.synchronization.SampleSyncTaskTest.java
@Ignore @Test/* w ww. j a v a 2 s . com*/ public void testSync_noLocalRepo() throws IOException, GitAPIException { // Sync files from mock Git Hub repo to mock local Android sample template repo SampleSyncTask sampleSyncTask = new SampleSyncTask(mockAndroidRepoPath, mockGitHubRepoPath); sampleSyncTask.run(); File mockAndroidRepoDir = new File(mockAndroidRepoPath); Assert.assertTrue(mockAndroidRepoDir.exists()); Git mockAndroidRepo = Git.open(mockAndroidRepoDir); Assert.assertEquals("refs/heads/master", mockAndroidRepo.getRepository().getFullBranch()); Assert.assertEquals(1, mockAndroidRepo.branchList().setListMode(ListBranchCommand.ListMode.REMOTE).call().size()); File mockGitHubRepoDir = new File(mockGitHubRepoPath); Assert.assertTrue(mockGitHubRepoDir.exists()); File[] mockAndroidRepoFiles = mockAndroidRepoDir.listFiles(); File[] mockGitHubRepoFiles = mockGitHubRepoDir.listFiles(); Assert.assertEquals(mockGitHubRepoFiles.length, mockAndroidRepoFiles.length); int num = 0; for (File aFile : mockGitHubRepoFiles) { aFile.getName().equals(mockAndroidRepoFiles[0].getName()); num++; } }
From source file:interactivespaces.master.server.services.internal.ros.StandardMasterRosContextTest.java
/** * Test shutting down the context.//from w w w. j a va 2s . c om */ @Test public void testShutdown() { context.startup(); context.shutdown(); Mockito.verify(masterNode).shutdown(); // Wrong pieces in place for the node to call its listeners, so call directly. context.getMasterNodeListener().onShutdownComplete(context.getMasterNode()); Assert.assertTrue(rosMasterController.isShutdownCalled()); }