List of usage examples for junit.framework Assert assertFalse
static public void assertFalse(String message, boolean condition)
From source file:org.slc.sli.dashboard.unit.manager.CustomizationAssemblyFactoryTest.java
/** * Test data domain condition//w ww . j a v a 2s. c o m */ @Test public void testCondition() { Config panel = configMap.get("panel"); Assert.assertTrue("Must be true for a student with gender = 'male'", customizationAssemblyFactory.checkCondition(panel, panel, simpleMaleStudentEntity)); Assert.assertFalse("Must be true for a student with gender = 'male'", customizationAssemblyFactory.checkCondition(panel, panel, simpleFemaleStudentEntity)); Assert.assertFalse("Must be false for a student with no gender field available", customizationAssemblyFactory.checkCondition(panel, panel, simpleNoGenderInfoStudentEntity)); panel = configMap.get("panel1"); Assert.assertTrue("Must be true for a student with gradeNumeric = 5", customizationAssemblyFactory.checkCondition(panel, panel, simpleMaleStudentEntity)); Assert.assertFalse("Must be false for a student with gradeNumeric = 7", customizationAssemblyFactory.checkCondition(panel, panel, simpleFemaleStudentEntity)); }
From source file:com.rmn.qa.aws.VmManagerTest.java
@Test // Test terminating a valid but not matching instances is handled correctly public void testTerminateInstanceNoMatchingInstance() { MockAmazonEc2Client client = new MockAmazonEc2Client(null); String instanceId = "foo"; TerminateInstancesResult terminateInstancesResult = new TerminateInstancesResult(); client.setTerminateInstancesResult(terminateInstancesResult); InstanceStateChange stateChange = new InstanceStateChange(); stateChange.withInstanceId("notMatching"); stateChange.setCurrentState(new InstanceState().withCode(8)); terminateInstancesResult.setTerminatingInstances(Arrays.asList(stateChange)); Properties properties = new Properties(); String region = "east"; MockManageVm manageEC2 = new MockManageVm(client, properties, region); boolean success = manageEC2.terminateInstance(instanceId); TerminateInstancesRequest request = client.getTerminateInstancesRequest(); Assert.assertEquals("Instance id size should match", 1, request.getInstanceIds().size()); Assert.assertEquals("Instance ids should match", instanceId, request.getInstanceIds().get(0)); Assert.assertFalse("Termination call should have not been successful", success); }
From source file:com.rmn.qa.aws.VmManagerTest.java
@Test // Tests that the terminate code works when no matching results are returned by the client public void testTerminateInstanceNoInstanceEmpty() { MockAmazonEc2Client client = new MockAmazonEc2Client(null); String instanceId = "foo"; TerminateInstancesResult terminateInstancesResult = new TerminateInstancesResult(); client.setTerminateInstancesResult(terminateInstancesResult); terminateInstancesResult.setTerminatingInstances(CollectionUtils.EMPTY_COLLECTION); Properties properties = new Properties(); String region = "east"; MockManageVm manageEC2 = new MockManageVm(client, properties, region); boolean success = manageEC2.terminateInstance(instanceId); TerminateInstancesRequest request = client.getTerminateInstancesRequest(); Assert.assertEquals("Instance id size should match", 1, request.getInstanceIds().size()); Assert.assertEquals("Instance ids should match", instanceId, request.getInstanceIds().get(0)); Assert.assertFalse("Termination call should have not been successful", success); }
From source file:de.hybris.platform.catalog.jalo.CatalogTest.java
@Test public void testOrderOverride() { final String SRC = "relation.CategoryCategoryRelation.source.ordered"; final String TGT = "relation.CategoryCategoryRelation.target.ordered"; final String MARK_MODIFIED = "relation.CategoryCategoryRelation.markmodified"; final String srcBefore = Config.getParameter(SRC); final String tgtBefore = Config.getParameter(TGT); final String markBefore = Config.getParameter(MARK_MODIFIED); try {// ww w . j av a 2 s . c om Utilities.clearRelationOrderingOverrideCache(); Config.setParameter(SRC, "true"); Config.setParameter(TGT, "true"); boolean cat2cat_src = Config.getBoolean(SRC, true); assertTrue("Default should be true!", cat2cat_src); boolean cat2cat_tgt = Config.getBoolean(TGT, true); assertTrue("Default should be true!", cat2cat_tgt); boolean cat2cat_src_result = Utilities.getRelationOrderingOverride(SRC, true); assertEquals(cat2cat_src, cat2cat_src_result); boolean cat2cat_tgt_result = Utilities.getRelationOrderingOverride(SRC, true); assertEquals(cat2cat_tgt, cat2cat_tgt_result); Utilities.clearRelationOrderingOverrideCache(); Config.setParameter(SRC, "false"); cat2cat_src = Config.getBoolean(SRC, true); Assert.assertFalse("Should now be false!", cat2cat_src); Config.setParameter(TGT, "false"); cat2cat_tgt = Config.getBoolean(TGT, true); Assert.assertFalse("Should now be false!", cat2cat_tgt); cat2cat_src_result = Utilities.getRelationOrderingOverride(SRC, true); assertEquals(cat2cat_src, cat2cat_src_result); cat2cat_tgt_result = Utilities.getRelationOrderingOverride(SRC, true); assertEquals(cat2cat_tgt, cat2cat_tgt_result); Utilities.clearMarkModifiedOverrideCache(); Config.setParameter(MARK_MODIFIED, "true"); boolean markModified = Config.getBoolean(MARK_MODIFIED, true); assertTrue("Default is true", markModified); boolean markModified_result = Utilities.getMarkModifiedOverride(MARK_MODIFIED); assertTrue("Should also be true", markModified_result); Config.setParameter(MARK_MODIFIED, "false"); markModified = Config.getBoolean(MARK_MODIFIED, true); Assert.assertFalse("Now set to false", markModified); markModified_result = Utilities.getMarkModifiedOverride(MARK_MODIFIED); assertEquals(markModified, !markModified_result); //as it is still cached Utilities.clearMarkModifiedOverrideCache(); markModified_result = Utilities.getMarkModifiedOverride(MARK_MODIFIED); assertEquals(markModified, markModified_result); //as cache got cleared } finally { revertConfigIfNeeded(SRC, srcBefore); revertConfigIfNeeded(TGT, tgtBefore); revertConfigIfNeeded(MARK_MODIFIED, markBefore); Utilities.clearRelationOrderingOverrideCache(); Utilities.clearMarkModifiedOverrideCache(); } }
From source file:com.mnxfst.testing.server.cfg.TestPTestServerConfigurationParser.java
@Test public void testParserServeConfigurationWithArrayHavingAnValidXML() throws ServerConfigurationFailedException { byte[] test = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><ptest-server><hostname>test</hostname><port>123</port><socketPoolSize>321</socketPoolSize><contextHandlers><handler><path>/test</path><class>java.lang.String</class></handler><handler><path>/anotherTest</path><class>java.lang.Integer</class></handler></contextHandlers></ptest-server>" .getBytes();/*w w w . j a va 2 s .c o m*/ PTestServerConfiguration cfg = new PTestServerConfigurationParser().parseServerConfiguration(test); Assert.assertNotNull("The configuration object must not be null", cfg); Assert.assertEquals("The hostname must be test", "test", cfg.getHostname()); Assert.assertEquals("The port must be 123", 123, cfg.getPort()); Assert.assertEquals("The socket pool size must be 321", 321, cfg.getSocketPoolSize()); Assert.assertEquals("The size of the context handler set must be 2", 2, cfg.getContextHandlerSettings().size()); Set<NameValuePair> ctxSettings = cfg.getContextHandlerSettings("/test"); Assert.assertNotNull("The settings must not be null", ctxSettings); Assert.assertTrue("The element <class, java.lang.String> must be contained", ctxSettings.contains(new BasicNameValuePair("class", "java.lang.String"))); Assert.assertFalse("The element </anotherTest, java.lang.Integer> must not be contained", ctxSettings.contains(new BasicNameValuePair("/anotherTest", "java.lang.Integer"))); ctxSettings = cfg.getContextHandlerSettings("/anotherTest"); Assert.assertNotNull("The settings must not be null", ctxSettings); Assert.assertFalse("The element </test, java.lang.String> must not be contained", ctxSettings.contains(new BasicNameValuePair("/test", "java.lang.String"))); Assert.assertTrue("The element <class, java.lang.Integer> must be contained", ctxSettings.contains(new BasicNameValuePair("class", "java.lang.Integer"))); }
From source file:com.rmn.qa.aws.VmManagerTest.java
@Test //Tests that the client is initialized and exception is not thrown public void testClientInitialized() { AwsVmManager manageEC2 = new AwsVmManager(); String region = "east"; try {// w ww . ja v a 2s .c om manageEC2.launchNodes("foo", "bar", 4, "userData", false); } catch (Exception e) { Assert.assertFalse("The client should be initialized", e.getMessage().contains("The client is not initialized")); } }
From source file:com.vmware.identity.idm.client.TenantManagementTest.java
@TestOrderAnnotation(order = 36) @Test/* w w w . j a va2 s . com*/ public void testADProviderGetNestedParentGroups() throws Exception, IDMException { CasIdmClient idmClient = getIdmClient(); Properties props = getTestProperties(); String tenantName = props.getProperty(CFG_KEY_IDM_TENANT_1_NAME); Assert.assertNotNull(tenantName); Tenant tenant = IdmClientTestUtil.ensureTenantExists(idmClient, tenantName); Assert.assertNotNull(tenant); final String adUserName = props.getProperty(CFG_KEY_IDM_TENANT_1_ADPROVIDER_USER_LOOKUP_ID); Assert.assertNotNull(adUserName); final String adDomainName = props.getProperty(CFG_KEY_IDM_TENANT_1_AD_PROVIDER_DOMAIN_NAME); Assert.assertNotNull(adDomainName); PrincipalId principal = new PrincipalId(adUserName, adDomainName); Set<Group> nestedGroups = idmClient.findNestedParentGroups(tenantName, principal); Assert.assertNotNull("nestedGroups must not be null", nestedGroups); Assert.assertFalse("nestedGroups must not be empty", nestedGroups.isEmpty()); final String candidateGroupName = "Group1"; boolean foundCandidateGroup = false; for (Group g : nestedGroups) { if (candidateGroupName.compareToIgnoreCase(g.getName()) == 0) { foundCandidateGroup = true; break; } } Assert.assertTrue(String.format("nestedGroups must include '%s'", candidateGroupName), foundCandidateGroup); }
From source file:com.facebook.appevents.internal.AppEventUtility.java
public static void assertIsNotMainThread() { if (BuildConfig.DEBUG) { Assert.assertFalse("Call cannot be made on the main thread", isMainThread()); }/*from w ww .j a v a2s . co m*/ }
From source file:net.sourceforge.seqware.common.metadata.MetadataWSTest.java
@Test public void testGetAllSequencerRuns() { Log.info("testGetAllSequencerRuns"); List<SequencerRun> runs = instance.getAllSequencerRuns(); Assert.assertFalse("There are no sequencer runs!", runs.isEmpty()); }
From source file:net.sourceforge.seqware.common.metadata.MetadataWSTest.java
@Test public void testGetLanesFrom() { Log.info("testGetLanesFrom"); List<Lane> lanes = instance.getLanesFrom(4715); Assert.assertFalse("There are no lanes for sequencer run!", lanes.isEmpty()); }