List of usage examples for junit.framework Assert assertFalse
static public void assertFalse(boolean condition)
From source file:com.github.neoio.net.message.staging.memory.TestMemoryMessageStaging.java
@Test public void test_tempRead() { ByteBuffer buffer = ByteBuffer.allocate(1024); buffer.put("Hello World".getBytes()); buffer.rewind();//from www.j a va 2 s . c om staging.writeTempReadBytes(buffer); Assert.assertTrue(staging.hasTempReadBytes()); buffer.clear(); staging.readTempReadBytes(buffer); Assert.assertEquals("Hello World", new String(ArrayUtils.subarray(buffer.array(), 0, "Hello World".getBytes().length))); staging.resetTempReadBytes(); Assert.assertFalse(staging.hasTempReadBytes()); }
From source file:org.openmrs.module.sdmxhdintegration.SDMXHDMessageValidatorTest.java
@Test @Verifies(value = "should accept if valid", method = "validate(Object, Errors)") public void validate_shouldAcceptIfValid() { SDMXHDMessage message = new SDMXHDMessage(); message.setName("Test"); message.setDescription("Description"); message.setZipFilename("dummy.zip"); Errors errors = new BindException(message, "message"); validator.validate(message, errors); Assert.assertFalse(errors.hasErrors()); }
From source file:org.openspaces.itest.esb.mule.config.ConnectorConfigPropertiesFileTests.java
@Test public void testConnectorConfig() throws Exception { ApplicationContext context = muleContext.getRegistry() .lookupObject(SpringRegistry.SPRING_APPLICATION_CONTEXT); OpenSpacesQueueConnector connector = (OpenSpacesQueueConnector) context.getBean("queueConnector"); Assert.assertNotNull(connector);/*from www. j a v a 2s . co m*/ Assert.assertEquals(Integer.valueOf(100), connector.getBatchSize()); Assert.assertEquals(60000L, connector.getTimeout()); Assert.assertTrue(connector.isFifo()); Assert.assertFalse(connector.isPersistent()); }
From source file:com.couchbase.lite.BlobStoreTest.java
@Override protected void setUp() throws Exception { super.setUp(); // Create blob store: File storeFile = new File(manager.getDirectory(), "BlobStoreTest"); FileDirUtils.deleteRecursive(storeFile); Assert.assertFalse(storeFile.exists()); if (encrypt)//ww w. j a v a2s . c o m Log.i(TAG, "---- Now enabling attachment encryption ----"); store = new BlobStore(manager.getContext(), storeFile.getPath(), (encrypt ? new SymmetricKey() : null), true); // If using encryption, the encryption marker must exist: File enMarkerFile = new File(storeFile, BlobStore.ENCRYPTION_MARKER_FILENAME); boolean markerExists = enMarkerFile.exists(); Assert.assertEquals(encrypt, markerExists); }
From source file:com.github.neoio.net.message.staging.file.TestFileMessageStaging.java
@Test public void test_tempRead() { ByteBuffer buffer = ByteBuffer.allocate(1024); buffer.put("Hello World".getBytes()); buffer.flip();/*from ww w .j av a 2s . c o m*/ staging.writeTempReadBytes(buffer); Assert.assertTrue(staging.hasTempReadBytes()); buffer.clear(); staging.readTempReadBytes(buffer); Assert.assertEquals("Hello World", new String(ArrayUtils.subarray(buffer.array(), 0, "Hello World".getBytes().length))); staging.resetTempReadBytes(); Assert.assertFalse(staging.hasTempReadBytes()); }
From source file:ejportal.webapp.action.UserActionTest.java
/** * Test cancel.//from w w w . j a v a2 s . c o m * * @throws Exception * the exception */ public void testCancel() throws Exception { Assert.assertEquals(this.action.cancel(), "mainMenu"); Assert.assertFalse(this.action.hasActionErrors()); this.action.setFrom("list"); Assert.assertEquals("cancel", this.action.cancel()); }
From source file:org.deviceconnect.android.manager.test.JSONConversionTest.java
/** * dConnectManager?BundleJSON????????????. * /*from w w w . j av a2 s.co m*/ * @throws JSONException ??????? */ public void testConversion() throws JSONException { StringBuilder builder = new StringBuilder(); builder.append(DCONNECT_MANAGER_URI); builder.append("/json_test"); builder.append("?"); builder.append(DConnectMessage.EXTRA_DEVICE_ID + "=" + getDeviceId()); builder.append("&"); builder.append(DConnectMessage.EXTRA_ACCESS_TOKEN + "=" + getAccessToken()); HttpUriRequest request = new HttpGet(builder.toString()); JSONObject response = sendRequest(request); assertResultOK(response); JSONObject root = response.getJSONObject("extra"); Assert.assertNotNull("root is null.", root); Assert.assertFalse(root.has(IntentDConnectMessage.EXTRA_REQUEST_CODE)); Assert.assertEquals("http://localhost:8080", root.getString("uri")); Assert.assertEquals(0, root.getInt("byte")); Assert.assertEquals('0', root.getInt("char")); Assert.assertEquals(0, root.getInt("int")); Assert.assertEquals(0L, root.getLong("long")); Assert.assertEquals(0.0, root.getDouble("float"), TEST_FLOATING_VALUE); Assert.assertEquals(0.0, root.getDouble("double"), TEST_FLOATING_VALUE); Assert.assertEquals(false, root.getBoolean("boolean")); Assert.assertEquals(0, root.getInt(Byte.class.getName())); Assert.assertEquals('0', root.getInt(Character.class.getName())); Assert.assertEquals(0, root.getInt(Integer.class.getName())); Assert.assertEquals(0L, root.getLong(Long.class.getName())); Assert.assertEquals(0.0, root.getDouble(Float.class.getName()), TEST_FLOATING_VALUE); Assert.assertEquals(0.0, root.getDouble(Double.class.getName()), TEST_FLOATING_VALUE); Assert.assertEquals(false, root.getBoolean(Boolean.class.getName())); Assert.assertEquals(String.class.getName(), root.getString(String.class.getName())); Assert.assertEquals(1, root.getJSONArray(int[].class.getName()).length()); Assert.assertEquals(0, root.getJSONArray(int[].class.getName()).get(0)); Assert.assertEquals(1, root.getJSONArray(long[].class.getName()).length()); Assert.assertEquals(0L, root.getJSONArray(long[].class.getName()).getLong(0)); Assert.assertEquals(1, root.getJSONArray(float[].class.getName()).length()); Assert.assertEquals(0.0, root.getJSONArray(float[].class.getName()).getDouble(0), TEST_FLOATING_VALUE); Assert.assertEquals(1, root.getJSONArray(double[].class.getName()).length()); Assert.assertEquals(0.0, root.getJSONArray(double[].class.getName()).getDouble(0), TEST_FLOATING_VALUE); Assert.assertEquals(1, root.getJSONArray(boolean[].class.getName()).length()); Assert.assertEquals(false, root.getJSONArray(boolean[].class.getName()).get(0)); Assert.assertEquals(1, root.getJSONArray(Integer[].class.getName()).length()); Assert.assertEquals(0, root.getJSONArray(Integer[].class.getName()).get(0)); Assert.assertEquals(1, root.getJSONArray(Long[].class.getName()).length()); Assert.assertEquals(0L, root.getJSONArray(Long[].class.getName()).getLong(0)); Assert.assertEquals(1, root.getJSONArray(Float[].class.getName()).length()); Assert.assertEquals(0.0, root.getJSONArray(Float[].class.getName()).getDouble(0), TEST_FLOATING_VALUE); Assert.assertEquals(1, root.getJSONArray(Double[].class.getName()).length()); Assert.assertEquals(0.0, root.getJSONArray(Double[].class.getName()).getDouble(0), TEST_FLOATING_VALUE); Assert.assertEquals(1, root.getJSONArray(Boolean[].class.getName()).length()); Assert.assertEquals(false, root.getJSONArray(Boolean[].class.getName()).get(0)); Assert.assertEquals(1, root.getJSONArray(String[].class.getName()).length()); Assert.assertEquals("String", root.getJSONArray(String[].class.getName()).get(0)); Assert.assertNotNull(root.getJSONObject(Bundle.class.getName())); Assert.assertEquals(1, root.getJSONArray(Bundle[].class.getName()).length()); Assert.assertNotNull(root.getJSONArray(Bundle[].class.getName()).get(0)); Assert.assertEquals(1, root.getJSONArray("ArrayList<Integer>").length()); Assert.assertEquals(0, root.getJSONArray("ArrayList<Integer>").get(0)); }
From source file:org.atemsource.atem.impl.pojo.CollectionAssociationAttributeTest.java
@Test public void isEqual() { EntityA a1 = new EntityA(); a1.setList(new ArrayList<EntityB>()); final EntityB b1 = new EntityB(); a1.getList().add(b1);//from www . ja va 2s . co m b1.setInteger(1); EntityA a2 = new EntityA(); a2.setList(new ArrayList<EntityB>()); final EntityB b2 = new EntityB(); a2.getList().add(b2); b2.setInteger(3); EntityType entityType = entityTypeRepository.getEntityType(EntityA.class); ListAssociationAttribute attribute = (ListAssociationAttribute) entityType.getAttribute("list"); Assert.assertFalse(attribute.isEqual(a1, a2)); b2.setInteger(1); Assert.assertTrue(attribute.isEqual(a1, a2)); }
From source file:com.onesite.sdk.test.api.SessionApiTest.java
@Test public void testCreateAnonymous() { SessionApi api = new SessionApi(); try {/* ww w .j a v a2 s . co m*/ Session testSession = new Session(); testSession.setIp(ip); testSession.setAgent(agent); Session session = api.create(testSession); System.out.println("Anonymous Session"); System.out.println("coreU: " + session.getCoreU()); System.out.println("coreX: " + session.getCoreU()); Assert.assertFalse(StringUtils.isEmpty(session.getCoreU())); } catch (Exception e) { e.printStackTrace(); Assert.fail(); } }
From source file:org.openmrs.module.kenyaemr.form.KenyaEmrVelocityFunctionsTest.java
/** * @see org.openmrs.module.kenyaemr.form.KenyaEmrVelocityFunctions#hasHivUniquePatientNumber() */// w w w . j av a 2 s . com @Test public void hasHivUniquePatientNumber() { // Patient #6 doesn't have a UPN Assert.assertFalse(functionsForSession1.hasHivUniquePatientNumber()); // Patient #7 has a UPN Assert.assertTrue(functionsForSession2.hasHivUniquePatientNumber()); }