List of usage examples for java.lang AssertionError getMessage
public String getMessage()
From source file:org.opencb.opencga.storage.core.variant.VariantStorageBaseTest.java
public void assertWithConflicts(Variant variant, Runnable assertCondition) { try {/*from w w w. j av a 2s . c o m*/ assertCondition.run(); } catch (AssertionError e) { if (VARIANTS_WITH_CONFLICTS.contains(variant.toString())) { logger.error(e.getMessage()); } else { throw e; } } }
From source file:com.enonic.cms.itest.content.ContentServiceImpl_updateContentTest.java
@Test public void testUpdateDeletedContent() { UserEntity testUser = fixture.findUserByName("testuser"); CreateContentCommand createCommand = createCreateContentCommand(ContentStatus.DRAFT.getKey(), testUser); ContentKey contentKey = contentService.createContent(createCommand); fixture.flushAndClearHibernateSesssion(); ContentEntity persistedContent = contentDao.findByKey(contentKey); contentService.deleteContent(fixture.findUserByName("testuser"), persistedContent); fixture.flushAndClearHibernateSesssion(); persistedContent = contentDao.findByKey(contentKey); assertTrue(persistedContent.isDeleted()); UpdateContentCommand command = createUpdateContentCommand(contentKey, persistedContent.getDraftVersion().getKey(), ContentStatus.DRAFT.getKey(), false, false); String newName = "content-updated"; command.setContentName(newName);/* w ww . ja v a 2 s. c om*/ try { contentService.updateContent(command); fail("Expected exception"); } catch (AssertionError e) { throw e; } catch (Throwable e) { assertTrue(e instanceof UpdateContentException); assertTrue(e.getMessage().toLowerCase().contains("deleted")); } }
From source file:net.javacrumbs.jsonunit.spring.ExampleControllerTest.java
@Test public void intValueShouldFailIfDoesNotMatch() throws Exception { try {//from ww w . j a v a2 s . c o m exec().andExpect(json().node("result.array").matches(everyItem(lessThanOrEqualTo(valueOf(2))))); failIfNoException(); } catch (AssertionError e) { assertEquals("Node \"result.array\" does not match.\n" + "Expected: every item is a value less than or equal to <2>\n" + " but: an item <3> was greater than <2>", e.getMessage()); } }
From source file:org.apache.drill.TestFrameworkTest.java
@Test public void testCSVVerification_extra_column_fails() throws Exception { try {/*from w w w. j av a2 s . com*/ testBuilder() .sqlQuery("select " + CSV_COLS + ", columns[3] as address from cp.`testframework/small_test_data_extra_col.tsv`") .ordered().csvBaselineFile("testframework/small_test_data.tsv") .baselineTypes(TypeProtos.MinorType.BIGINT, TypeProtos.MinorType.VARCHAR, TypeProtos.MinorType.VARCHAR) .baselineColumns("employee_id", "first_name", "last_name").build().run(); } catch (AssertionError ex) { assertEquals("Unexpected extra column `address` returned by query.", ex.getMessage()); // this indicates successful completion of the test return; } throw new Exception("Test framework verification failed, expected failure on extra column."); }
From source file:org.apache.drill.TestFrameworkTest.java
@Test public void testEmptyResultSet() throws Exception { testBuilder().sqlQuery("select * from cp.`store/json/json_simple_with_null.json` where 1=0") .expectsEmptyResultSet().build().run(); try {// ww w . j a v a 2 s . c o m testBuilder().sqlQuery("select * from cp.`store/json/json_simple_with_null.json`") .expectsEmptyResultSet().build().run(); } catch (AssertionError ex) { assertEquals("Different number of records returned expected:<0> but was:<4>", ex.getMessage()); // this indicates successful completion of the test return; } throw new Exception("Test framework verification failed, expected failure on unexpected records."); }
From source file:org.apache.drill.TestFrameworkTest.java
@Test public void testCSVVerification_extra_records_fails() throws Exception { try {//from ww w .ja v a 2s .c om testBuilder().sqlQuery("select " + CSV_COLS + " from cp.`testframework/small_test_data_extra.tsv`") .ordered().csvBaselineFile("testframework/small_test_data.tsv") .baselineTypes(TypeProtos.MinorType.BIGINT, TypeProtos.MinorType.VARCHAR, TypeProtos.MinorType.VARCHAR) .baselineColumns("employee_id", "first_name", "last_name").build().run(); } catch (AssertionError ex) { assertEquals("Incorrect number of rows returned by query. expected:<5> but was:<7>", ex.getMessage()); // this indicates successful completion of the test return; } throw new Exception("Test framework verification failed, expected failure for extra records."); }
From source file:org.apache.drill.TestFrameworkTest.java
@Test public void testCSVVerification_missing_records_fails() throws Exception { try {/* w ww .j a v a2 s.com*/ testBuilder().sqlQuery( "select employee_id, first_name, last_name from cp.`testframework/small_test_data.json`") .ordered().csvBaselineFile("testframework/small_test_data_extra.tsv") .baselineTypes(TypeProtos.MinorType.BIGINT, TypeProtos.MinorType.VARCHAR, TypeProtos.MinorType.VARCHAR) .baselineColumns("employee_id", "first_name", "last_name").build().run(); } catch (AssertionError ex) { assertEquals("Incorrect number of rows returned by query. expected:<7> but was:<5>", ex.getMessage()); // this indicates successful completion of the test return; } throw new Exception("Test framework verification failed, expected failure on missing records."); }
From source file:org.cloudifysource.quality.iTests.test.cli.cloudify.cloud.services.byon.ByonCloudService.java
private void cleanCloudifyTempDir() { String command = "rm -rf /export/tgrid/.cloudify/"; if (sudo) {/*w ww.j av a2s . com*/ command = "sudo " + command; } try { LogUtils.log(SSHUtils.runCommand(this.getMachines()[0], AbstractTestSupport.OPERATION_TIMEOUT, command, user, password)); } catch (AssertionError e) { LogUtils.log("Failed to clean files .cloudify folder Reason --> " + e.getMessage()); } }
From source file:org.cloudifysource.quality.iTests.test.cli.cloudify.cloud.services.byon.ByonCloudService.java
private void cleanGSFilesOnAllHosts() { String command = "rm -rf /tmp/tgrid/gs-files"; if (sudo) {// w w w .j av a 2 s. c o m command = "sudo " + command; } String[] hosts = this.getMachines(); for (String host : hosts) { try { LogUtils.log( SSHUtils.runCommand(host, AbstractTestSupport.OPERATION_TIMEOUT, command, user, password)); } catch (AssertionError e) { LogUtils.log("Failed to clean files on host " + host + " .Reason --> " + e.getMessage()); } } }
From source file:org.cloudifysource.quality.iTests.test.cli.cloudify.cloud.services.byon.ByonCloudService.java
public void removePersistencyFolder() { String command = "rm -rf " + getCloud().getConfiguration().getPersistentStoragePath(); if (sudo) {// w ww .j av a 2 s . c o m command = "sudo " + command; } String[] hosts = this.getMachines(); for (String host : hosts) { try { LogUtils.log( SSHUtils.runCommand(host, AbstractTestSupport.OPERATION_TIMEOUT, command, user, password)); } catch (AssertionError e) { LogUtils.log("Failed to clean files on host " + host + " .Reason --> " + e.getMessage()); } } }