List of usage examples for junit.framework Assert assertEquals
static public void assertEquals(int expected, int actual)
From source file:org.atemsource.atem.impl.pojo.ArrayAttributeFactoryTest.java
@Test public void testArray() { EntityType entityType = entityTypeRepository.getEntityType(EntityA.class); CollectionAttribute attribute = (CollectionAttribute) entityType.getAttribute("stringArray"); Assert.assertNotNull(attribute);//from w w w.j a va 2 s . c o m EntityA a = new EntityA(); a.setStringArray(new String[] { "halo", "baba" }); Assert.assertEquals(attribute.getSize(a), 2); }
From source file:azkaban.app.AzkabanApplicationTest.java
@Test public void testAddJobAndReload() throws Exception { String testJob = "testjob"; AzkabanApplication app = new AzkabanApplication(Arrays.asList(jobDir), logDir, tmpDir, false); Assert.assertEquals(0, app.getJobManager().loadJobDescriptors().size()); Assert.assertNull(app.getJobManager().getJobDescriptor(testJob)); File newJobDir = new File(jobDir, "test"); FileUtils.forceMkdir(newJobDir);//w w w . j a v a 2s .c o m File newJob = new File(newJobDir, testJob + ".job"); FileUtils.writeLines(newJob, Arrays.asList("type=command", "command=ls")); app.reloadJobsFromDisk(); Assert.assertEquals(1, app.getJobManager().loadJobDescriptors().size()); Job loadedJob = app.getJobManager().loadJob(testJob, true); Assert.assertEquals(testJob, loadedJob.getId()); Assert.assertTrue(loadedJob instanceof LoggingJob); Assert.assertTrue(((LoggingJob) loadedJob).getInnerJob() instanceof ProcessJob); }
From source file:org.jasig.ssp.util.importer.job.CarriageReturnTest.java
@Test public void testCarriageReturn() throws Exception { JobExecution jobExecution = jobLauncherTestUtils.launchJob(); BatchStatus exitStatus = jobExecution.getStatus(); Assert.assertEquals(BatchStatus.COMPLETED, exitStatus); }
From source file:org.ocpsoft.rewrite.servlet.config.HttpConfigurationOrderTest.java
@Test public void testLowerPriorityConfigsEvaluateFirst() throws Exception { HttpAction<HttpGet> action = get("/path"); Assert.assertEquals(201, action.getResponse().getStatusLine().getStatusCode()); }
From source file:com.metamx.druid.index.v1.IndexMergerTest.java
@Test public void testPersistCaseInsensitive() throws Exception { final long timestamp = System.currentTimeMillis(); IncrementalIndex toPersist = IncrementalIndexTest.createCaseInsensitiveIndex(timestamp); final File tempDir = Files.createTempDir(); try {// w w w . ja va2 s .co m QueryableIndex index = IndexIO.loadIndex(IndexMerger.persist(toPersist, tempDir)); Assert.assertEquals(2, index.getTimeColumn().getLength()); Assert.assertEquals(Arrays.asList("dim1", "dim2"), Lists.newArrayList(index.getAvailableDimensions())); Assert.assertEquals(2, index.getColumnNames().size()); } finally { tempDir.delete(); } }
From source file:fr.msch.wissl.server.TestLogin.java
@Test public void test() throws IOException, JSONException { HttpClient client = new HttpClient(); // good username, bad password: error 401 PostMethod post = new PostMethod(TServer.URL + "login"); post.addParameter("username", admin_username); post.addParameter("password", "bad_password"); client.executeMethod(post);//w w w.j ava 2 s . c o m post.getResponseBodyAsString(); Assert.assertEquals(401, post.getStatusCode()); // empty password and username: error 401 post = new PostMethod(TServer.URL + "login"); post.addParameter("username", ""); post.addParameter("password", ""); client.executeMethod(post); post.getResponseBodyAsString(); Assert.assertEquals(401, post.getStatusCode()); // log in as admin post = new PostMethod(TServer.URL + "login"); post.addParameter("username", admin_username); post.addParameter("password", admin_password); client.executeMethod(post); String ret = post.getResponseBodyAsString(); JSONObject obj = new JSONObject(ret); int uid_admin = obj.getInt("userId"); String sid_admin = obj.getString("sessionId"); int auth = obj.getInt("auth"); Assert.assertEquals(200, post.getStatusCode()); Assert.assertEquals(uid_admin, this.admin_userId); Assert.assertNotNull(UUID.fromString(sid_admin)); Assert.assertEquals(auth, 1); // call 'stats' with this session, should succeed GetMethod get = new GetMethod(TServer.URL + "stats"); get.addRequestHeader("sessionId", sid_admin); client.executeMethod(get); Assert.assertEquals(200, get.getStatusCode()); // the previous session that was setup by the test case // for this user should NOT have been destroyed // both sessions are kept for the same user get = new GetMethod(TServer.URL + "stats"); get.addRequestHeader("sessionId", this.admin_sessionId); client.executeMethod(get); Assert.assertEquals(200, get.getStatusCode()); // the other user set up by the test case should still be logged in get = new GetMethod(TServer.URL + "stats"); get.addRequestHeader("sessionId", this.user_sessionId); client.executeMethod(get); Assert.assertEquals(200, get.getStatusCode()); // logout all users post = new PostMethod(TServer.URL + "logout"); post.addRequestHeader("sessionId", sid_admin); client.executeMethod(post); Assert.assertEquals(204, post.getStatusCode()); post = new PostMethod(TServer.URL + "logout"); post.addRequestHeader("sessionId", this.user_sessionId); client.executeMethod(post); Assert.assertEquals(204, post.getStatusCode()); post = new PostMethod(TServer.URL + "logout"); post.addRequestHeader("sessionId", this.admin_sessionId); client.executeMethod(post); Assert.assertEquals(204, post.getStatusCode()); // check that neither client can call 'stats' get = new GetMethod(TServer.URL + "stats"); get.addRequestHeader("sessionId", sid_admin); client.executeMethod(get); Assert.assertEquals(401, get.getStatusCode()); get = new GetMethod(TServer.URL + "stats"); get.addRequestHeader("sessionId", this.user_sessionId); client.executeMethod(get); Assert.assertEquals(401, get.getStatusCode()); }
From source file:com.google.api.ads.adwords.awreporting.model.definitions.ReportAccountDefinitionTest.java
/** * @see com.google.api.ads.adwords.awreporting.model.definitions. * AbstractReportDefinitionTest#testFirstEntry( * com.google.api.ads.adwords.awreporting.model.entities.Report) *//*from ww w .j ava 2s .c om*/ @Override protected void testFirstEntry(ReportAccount first) { Assert.assertEquals(1232198123L, first.getAccountId().longValue()); Assert.assertEquals("2013-05-01", first.getDay()); Assert.assertEquals("Test Le Test", first.getAccountDescriptiveName()); Assert.assertEquals(1.42, first.getCost().doubleValue()); Assert.assertEquals(10L, first.getClicks().longValue()); Assert.assertEquals(1978L, first.getImpressions().longValue()); Assert.assertEquals(0L, first.getConversions().longValue()); Assert.assertEquals(0.51, first.getCtrBigDecimal().doubleValue()); Assert.assertEquals(0.72, first.getAvgCpm().doubleValue()); Assert.assertEquals(0.14, first.getAvgCpc().doubleValue()); Assert.assertEquals(2.97, first.getAvgPositionBigDecimal().doubleValue()); Assert.assertEquals("EUR", first.getCurrencyCode()); Assert.assertEquals("Search Network", first.getAdNetwork()); Assert.assertEquals(17.40, first.getSearchLostISBudgetBigDecimal().doubleValue()); Assert.assertEquals(42.93, first.getSearchLostISRankBigDecimal().doubleValue()); Assert.assertEquals(0.0, first.getContentLostISBudgetBigDecimal().doubleValue()); Assert.assertEquals(0.0, first.getContentLostISRankBigDecimal().doubleValue()); }
From source file:com.google.api.ads.adwords.awreporting.model.definitions.ReportAdGroupDefinitionTest.java
/** * @see com.google.api.ads.adwords.awreporting.model.definitions. * AbstractReportDefinitionTest#testFirstEntry( * com.google.api.ads.adwords.awreporting.model.entities.Report) *///www. j av a2 s. c o m @Override protected void testFirstEntry(ReportAdGroup first) { Assert.assertEquals(1230945123L, first.getAccountId().longValue()); Assert.assertEquals("2013-05-07", first.getDay()); Assert.assertEquals(2.72, first.getCost().doubleValue()); Assert.assertEquals(6L, first.getClicks().longValue()); Assert.assertEquals(16L, first.getImpressions().longValue()); Assert.assertEquals(0L, first.getConversions().longValue()); Assert.assertEquals(37.50, first.getCtrBigDecimal().doubleValue()); Assert.assertEquals(170.00, first.getAvgCpm().doubleValue()); Assert.assertEquals(0.45, first.getAvgCpc().doubleValue()); Assert.assertEquals(2.69, first.getAvgPositionBigDecimal().doubleValue()); Assert.assertEquals("EUR", first.getCurrencyCode()); Assert.assertEquals(129807304L, first.getCampaignId().longValue()); Assert.assertEquals(7253055064L, first.getAdGroupId().longValue()); Assert.assertEquals("enabled", first.getStatus()); }
From source file:com.ancientprogramming.fixedformat4j.format.impl.TestNullableFixedFormatManagerImpl.java
public void testLoadNullableRecord() { MyNullableRecord loadedRecord = manager.load(MyNullableRecord.class, MY_NULLABLE_RECORD_DATA); Assert.assertNotNull(loadedRecord);/*from ww w . ja va2 s. com*/ Assert.assertEquals(null, loadedRecord.getStringData()); Assert.assertTrue(loadedRecord.isBooleanData()); }
From source file:com.art4ul.jcoon.util.HttpRequestUtilTests.java
@Test public void getAcceptedTypesTest() { String[] array = new String[] { "value1", "value2", "value3", "value4" }; List<MediaType> mediaTypes = HttpRequestUtil.getAcceptedTypes(array); Assert.assertEquals(4, mediaTypes.size()); Assert.assertEquals("getAcceptedTypes method should return empty list in case of input parameter is NULL", 0, HttpRequestUtil.getAcceptedTypes(null).size()); }