Java Code Examples for junit.framework.Assert#assertFalse()
The following examples show how to use
junit.framework.Assert#assertFalse() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ColorScaleTest.java From mrgeo with Apache License 2.0 | 6 votes |
@Test @Category(UnitTest.class) public void testLoadXmlDefaults() throws ColorScale.ColorScaleException { String xml = "<ColorMap name=\"Rainbow\">"; xml += "<Scaling>Absolute</Scaling>"; //This tag is required, even though ColorScale object is initialized to Absolute xml += "<Color value=\"0.0\" color=\"0,0,127\" opacity=\"255\"/>"; xml += "<Color value=\"0.2\" color=\"0,0,255\"/>"; xml += "<Color value=\"0.4\" color=\"0,255,255\"/>"; xml += "<Color value=\"0.6\" color=\"0,255,0\"/>"; xml += "<Color value=\"0.8\" color=\"255,255,0\"/>"; xml += "<Color value=\"1.0\" color=\"255,0,0\"/>"; xml += "</ColorMap>"; InputStream is = new ByteArrayInputStream(xml.getBytes()); ColorScale cs = ColorScale.loadFromXML(is); Assert.assertTrue(ColorScale.Scaling.Absolute.name().equals(cs.getScaling().name())); Assert.assertFalse(cs.getForceValuesIntoRange()); Assert.assertTrue(cs.getInterpolate()); Assert.assertEquals(6, cs.size()); int[] color = new int[4]; cs.lookup(0.4, color); check(color, new int[]{0, 255, 255, 255}); }
Example 2
Source File: ForwardRegisterTrackingTransformationProviderTest.java From binnavi with Apache License 2.0 | 6 votes |
@Test public void testTransformMulFirstInputIsZero() { final RegisterTrackingTransformationProvider transformationProvider = new RegisterTrackingTransformationProvider(new RegisterTrackingOptions(false, new TreeSet<String>(), false, AnalysisDirection.DOWN)); final ReilInstruction instruction = ReilHelpers.createMul(0, OperandSize.DWORD, String.valueOf("0"), OperandSize.DWORD, "ecx", OperandSize.DWORD, "eax"); final Pair<RegisterSetLatticeElement, RegisterSetLatticeElement> transformationResult = transformationProvider.transformMul(instruction, createTaintedState("ecx")); Assert.assertNull(transformationResult.second()); transformationResult.first().onInstructionExit(); Assert.assertTrue(transformationResult.first().getNewlyTaintedRegisters().isEmpty()); Assert.assertTrue(transformationResult.first().getReadRegisters().isEmpty()); Assert.assertTrue(transformationResult.first().getTaintedRegisters().contains("ecx")); Assert.assertFalse(transformationResult.first().getTaintedRegisters().contains("eax")); Assert.assertTrue(transformationResult.first().getUntaintedRegisters().isEmpty()); Assert.assertTrue(transformationResult.first().getUpdatedRegisters().isEmpty()); }
Example 3
Source File: TestChangeVolumeState.java From zstack with Apache License 2.0 | 6 votes |
@Test public void test() throws ApiSenderException { DiskOfferingInventory dinv = new DiskOfferingInventory(); dinv.setDiskSize(SizeUnit.GIGABYTE.toByte(10)); dinv.setName("Test"); dinv.setDescription("Test"); dinv = api.addDiskOffering(dinv); VolumeInventory vinv = api.createDataVolume("TestData", dinv.getUuid()); Assert.assertEquals(VolumeStatus.NotInstantiated.toString(), vinv.getStatus()); Assert.assertEquals(VolumeType.Data.toString(), vinv.getType()); Assert.assertFalse(vinv.isAttached()); Assert.assertEquals(VolumeState.Enabled.toString(), vinv.getState()); vinv = api.changeVolumeState(vinv.getUuid(), VolumeStateEvent.disable); Assert.assertEquals(VolumeState.Disabled.toString(), vinv.getState()); vinv = api.changeVolumeState(vinv.getUuid(), VolumeStateEvent.enable); Assert.assertEquals(VolumeState.Enabled.toString(), vinv.getState()); }
Example 4
Source File: TestSnapshotOnKvm45.java From zstack with Apache License 2.0 | 6 votes |
private void deltaSnapshot(VolumeSnapshotInventory inv, int distance) { Assert.assertEquals(VolumeSnapshotState.Enabled.toString(), inv.getState()); Assert.assertEquals(VolumeSnapshotStatus.Ready.toString(), inv.getStatus()); VolumeVO vol = dbf.findByUuid(inv.getVolumeUuid(), VolumeVO.class); VolumeSnapshotVO svo = dbf.findByUuid(inv.getUuid(), VolumeSnapshotVO.class); Assert.assertNotNull(svo); Assert.assertFalse(svo.isFullSnapshot()); Assert.assertTrue(svo.isLatest()); Assert.assertNotNull(svo.getParentUuid()); Assert.assertEquals(distance, svo.getDistance()); Assert.assertEquals(vol.getPrimaryStorageUuid(), svo.getPrimaryStorageUuid()); Assert.assertNotNull(svo.getPrimaryStorageInstallPath()); VolumeSnapshotTreeVO cvo = dbf.findByUuid(svo.getTreeUuid(), VolumeSnapshotTreeVO.class); Assert.assertNotNull(cvo); Assert.assertTrue(cvo.isCurrent()); Assert.assertEquals(svo.getTreeUuid(), cvo.getUuid()); }
Example 5
Source File: LocatorLoadSnapshotJUnitTest.java From gemfirexd-oss with Apache License 2.0 | 6 votes |
public void testAreBalanced() { final LocatorLoadSnapshot sn = new LocatorLoadSnapshot(); Assert.assertTrue(sn.hasBalancedConnections(null)); Assert.assertTrue(sn.hasBalancedConnections("a")); final ServerLocation l1 = new ServerLocation("localhost", 1); final ServerLocation l2 = new ServerLocation("localhost", 2); final ServerLocation l3 = new ServerLocation("localhost", 3); sn.addServer(l1, new String[] {"a"}, new ServerLoad(0, 1, 0, 1)); sn.addServer(l2, new String[] {"a", "b"}, new ServerLoad(0, 1, 0, 1)); sn.addServer(l3, new String[] {"b"}, new ServerLoad(0, 1, 0, 1)); Assert.assertTrue(sn.hasBalancedConnections(null)); Assert.assertTrue(sn.hasBalancedConnections("a")); Assert.assertTrue(sn.hasBalancedConnections("b")); sn.updateLoad(l1, new ServerLoad(1,1,0,1)); Assert.assertTrue(sn.hasBalancedConnections(null)); Assert.assertTrue(sn.hasBalancedConnections("a")); Assert.assertTrue(sn.hasBalancedConnections("b")); sn.updateLoad(l2, new ServerLoad(2,1,0,1)); Assert.assertFalse(sn.hasBalancedConnections(null)); Assert.assertTrue(sn.hasBalancedConnections("a")); Assert.assertFalse(sn.hasBalancedConnections("b")); }
Example 6
Source File: ComparatorTest.java From AndroidAPS with GNU Affero General Public License v3.0 | 6 votes |
@Test public void checkTest() { Assert.assertTrue(Comparator.Compare.IS_EQUAL.check(1, 1)); Assert.assertTrue(Comparator.Compare.IS_LESSER.check(1, 2)); Assert.assertTrue(Comparator.Compare.IS_EQUAL_OR_LESSER.check(1, 2)); Assert.assertTrue(Comparator.Compare.IS_EQUAL_OR_LESSER.check(2, 2)); Assert.assertTrue(Comparator.Compare.IS_GREATER.check(2, 1)); Assert.assertTrue(Comparator.Compare.IS_EQUAL_OR_GREATER.check(2, 1)); Assert.assertTrue(Comparator.Compare.IS_EQUAL_OR_GREATER.check(2, 2)); Assert.assertFalse(Comparator.Compare.IS_LESSER.check(2, 1)); Assert.assertFalse(Comparator.Compare.IS_EQUAL_OR_LESSER.check(2, 1)); Assert.assertFalse(Comparator.Compare.IS_GREATER.check(1, 2)); Assert.assertFalse(Comparator.Compare.IS_EQUAL_OR_GREATER.check(1, 2)); Assert.assertTrue(Comparator.Compare.IS_NOT_AVAILABLE.check(1, null)); }
Example 7
Source File: ParcelCheckPackageTest.java From ParcelCheck with Apache License 2.0 | 5 votes |
/** * Test all parcels within package to see if they properly implement {@link Parcelable} * @throws Exception */ public void testParcels() throws Exception { String[] packages = getModelPackageNames(); boolean oneTestFailed = false; for (String pkg : packages) { ArrayList<String> classes = ObjectHelper.getClassesOfPackage(getContext(), pkg); Assert.assertFalse("No classes found in package " + pkg, classes == null || classes.size() == 0); for (String className : classes) { Class currentClass = getContext().getClassLoader().loadClass(pkg + "." + className); if (ObjectHelper.isParcelable(currentClass) && !Modifier.isAbstract(currentClass.getModifiers())) { /** * Helps us to not get into infinite loops if we have a structure in our models where something * like a Person model can have a Person field */ ObjectStack objectStack = new ObjectStack(); Parcelable parcelable = (Parcelable) ObjectHelper.getTestObject(objectStack, currentClass); Parcel parcel = Parcel.obtain(); parcelable.writeToParcel(parcel, 0); parcel.setDataPosition(0); Field creatorField = currentClass.getField("CREATOR"); Parcelable.Creator creator = (Parcelable.Creator) creatorField.get(null); Parcelable read = (Parcelable) creator.createFromParcel(parcel); if (!checkingForSuccess()) { boolean success = ObjectHelper.checkFieldsEqual(currentClass.getSimpleName(), parcelable, read, checkingForSuccess()); if (!success) { oneTestFailed = true; } } else { assertTrue(currentClass.getSimpleName() + " did not equal after parceling", ObjectHelper.checkFieldsEqual(currentClass.getSimpleName(), parcelable, read, checkingForSuccess())); } } } } if (!checkingForSuccess()) { assertTrue("You said that the test should fail, but they all passed. ???", oneTestFailed); } }
Example 8
Source File: SimpleJsonExamplesMessageBodyReaderTest.java From vw-webservice with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Test public void isReadableTest() { Assert.assertTrue(toTest.isReadable(ExamplesIterable.class, null, null, new MediaType() { @Override public String toString() { return ExampleMediaTypes.SIMPLE_JSON_0_1_0; } })); Assert.assertFalse(toTest.isReadable(ExamplesIterable.class, null, null, MediaType.TEXT_PLAIN_TYPE)); }
Example 9
Source File: TestCeph17.java From zstack with Apache License 2.0 | 5 votes |
@Test public void test() throws ApiSenderException, InterruptedException { VmGlobalConfig.VM_DELETION_POLICY.updateValue(VmInstanceDeletionPolicy.Direct.toString()); ImageGlobalConfig.DELETION_POLICY.updateValue(ImageDeletionPolicy.Direct.toString()); TimeUnit.SECONDS.sleep(5); ImageInventory img = deployer.images.get("TestImage"); SimpleQuery<ImageCacheVO> q = dbf.createQuery(ImageCacheVO.class); q.add(ImageCacheVO_.imageUuid, Op.EQ, img.getUuid()); ImageCacheVO c = q.find(); Assert.assertNotNull(c); api.deleteImage(img.getUuid()); TimeUnit.SECONDS.sleep(3); Assert.assertTrue(q.isExists()); VmInstanceInventory vm = deployer.vms.get("TestVm"); api.destroyVmInstance(vm.getUuid()); VmInstanceInventory vm1 = deployer.vms.get("TestVm1"); api.destroyVmInstance(vm1.getUuid()); PrimaryStorageInventory ceph = deployer.primaryStorages.get("ceph-pri"); config.deleteCmds.clear(); api.cleanupImageCache(ceph.getUuid()); TimeUnit.SECONDS.sleep(3); Assert.assertFalse(q.isExists()); Assert.assertFalse(config.deleteImageCacheCmds.isEmpty()); }
Example 10
Source File: EntityPersistHandlerTest.java From secure-data-service with Apache License 2.0 | 5 votes |
@Test public void testCreateTeacherSchoolAssociationEntity() { MongoEntityRepository entityRepository = mock(MongoEntityRepository.class); AbstractMessageReport errorReport = new DummyMessageReport(); ReportStats reportStats = new SimpleReportStats(); // Create a new student-school association entity, and test creating it in the data store. SimpleEntity foundTeacher = new SimpleEntity(); foundTeacher.setEntityId(INTERNAL_STUDENT_ID); LinkedList<Entity> teacherList = new LinkedList<Entity>(); teacherList.add(foundTeacher); // Teacher search. when(entityRepository.findAll(eq("teacher"), eq(regionIdStudentIdQuery))).thenReturn(teacherList); // School search. SimpleEntity foundSchool = new SimpleEntity(); foundSchool.setEntityId(INTERNAL_SCHOOL_ID); LinkedList<Entity> schoolList = new LinkedList<Entity>(); schoolList.add(foundSchool); when(entityRepository.findAll(eq("school"), eq(regionIdStudentIdQuery))).thenReturn(schoolList); SimpleEntity teacherSchoolAssociationEntity = createTeacherSchoolAssociationEntity(STUDENT_ID, false); entityPersistHandler.setEntityRepository(entityRepository); teacherSchoolAssociationEntity.getMetaData().put(EntityMetadataKey.TENANT_ID.getKey(), REGION_ID); entityPersistHandler.doHandling(teacherSchoolAssociationEntity, errorReport, reportStats); verify(entityRepository).createWithRetries(teacherSchoolAssociationEntity.getType(), null, teacherSchoolAssociationEntity.getBody(), teacherSchoolAssociationEntity.getMetaData(), teacherSchoolAssociationEntity.getType(), totalRetries); Assert.assertFalse("Error report should not contain errors", reportStats.hasErrors()); }
Example 11
Source File: HdfsAdHocDataProviderTest.java From mrgeo with Apache License 2.0 | 5 votes |
@Test @Category(UnitTest.class) public void testDeleteNamedNoData() throws Exception { Assert.assertFalse("Directory should not exist", HadoopFileUtils.exists(provider.getResourcePath())); HdfsAdHocDataProvider.delete(conf, provider.getResourceName(), providerProperties); Assert.assertFalse("Directory should not exist", HadoopFileUtils.exists(provider.getResourcePath())); }
Example 12
Source File: WebOSTVServiceTest.java From Connect-SDK-Android-Core with Apache License 2.0 | 5 votes |
@Test public void testCapabilitiesShouldContainSubtitlesForWebOsWithWebAppSupportAndDLNAPairingOn() { DiscoveryManager.getInstance().setPairingLevel(DiscoveryManager.PairingLevel.ON); injectDLNAService(); setWebOSVersion("5.0.0"); Assert.assertFalse(service.hasCapabilities(MediaPlayer.Subtitle_SRT)); Assert.assertTrue(service.hasCapabilities(MediaPlayer.Subtitle_WebVTT)); }
Example 13
Source File: JsonElementConstructorTest.java From celos with Apache License 2.0 | 5 votes |
@Test public void testCompareFailsOnKey() { String json1 = "{\"visitor\":{\"com.collective.pythia.avro.Visitor\":{\"cookie_id\":\"13174ef5358fb01\",\"segments\":[],\"edges\":{},\"behaviors\":{},\"birthdate\":0,\"association_ids\":{}}},\"events\":[{\"cookie_id\":\"13174ef5358fb01\",\"tstamp\":1403721351356,\"edge\":\"multiscreen\",\"changes\":{\"com.collective.pythia.avro.Command\":{\"operation\":\"ADD\",\"association_id\":{\"string\":\"44cb7937-93c4-4d54-9edf-b7683aec41a9\"},\"network\":\"device_apple_ida\",\"segments\":[]}}},{\"cookie_id\":\"13174ef5358fb01\",\"tstamp\":1403721352251,\"edge\":\"multiscreen\",\"changes\":{\"com.collective.pythia.avro.Command\":{\"operation\":\"ADD\",\"association_id\":{\"string\":\"b38cdc14ffde6226f2f54e5c82f9d0d1dba07796\"},\"network\":\"device_sha1\",\"segments\":[]}}},{\"cookie_id\":\"13174ef5358fb01\",\"tstamp\":1403721336557,\"edge\":\"multiscreen\",\"changes\":{\"com.collective.pythia.avro.Command\":{\"operation\":\"ADD\",\"association_id\":{\"string\":\"323ba4ba1502ac246c1a880ded9d6513\"},\"network\":\"device_md5\",\"segments\":[]}}},{\"cookie_id\":\"13174ef5358fb01\",\"tstamp\":1403721336557,\"edge\":\"multiscreen\",\"changes\":{\"com.collective.pythia.avro.Command\":{\"operation\":\"ADD\",\"association_id\":{\"string\":\"44626f1b-6f14-49a1-8273-a45e256cef18\"},\"network\":\"device_apple_ida\",\"segments\":[]}}}]}"; String json2 = "{\"visitor\":{\"com.collective.pythia.avro.Visitor\":{\"cookie_id\":\"13174ef5358fb01\",\"segments\":[],\"edges\":{},\"behaviors\":{},\"birthdate\":0,\"association_ids\":{}}},\"events\":[{\"cookie_id\":\"13174ef5358fb01\",\"tstamp\":1403721351356,\"edge\":\"multiscreen\",\"changes\":{\"com.collective.pythia.avro.Command\":{\"operation\":\"ADD\",\"association_id\":{\"string\":\"44cb7937-93c4-4d54-9edf-b7683aec41a9\"},\"network\":\"device_apple_ida\",\"segments\":[]}}},{\"cookie_id\":\"13174ef5358fb01\",\"tstamp\":1403721352251,\"edge\":\"multiscreen\",\"changes\":{\"com.collective.pythia.avro.Command\":{\"operation\":\"ADD\",\"association_id\":{\"string\":\"b38cdc14ffde6226f2f54e5c82f9d0d1dba07796\"},\"network\":\"device_sha1\",\"segmentz\":[]}}},{\"cookie_id\":\"13174ef5358fb01\",\"tstamp\":1403721336557,\"edge\":\"multiscreen\",\"changes\":{\"com.collective.pythia.avro.Command\":{\"operation\":\"ADD\",\"association_id\":{\"string\":\"323ba4ba1502ac246c1a880ded9d6513\"},\"network\":\"device_md5\",\"segments\":[]}}},{\"cookie_id\":\"13174ef5358fb01\",\"tstamp\":1403721336557,\"edge\":\"multiscreen\",\"changes\":{\"com.collective.pythia.avro.Command\":{\"operation\":\"ADD\",\"association_id\":{\"string\":\"44626f1b-6f14-49a1-8273-a45e256cef18\"},\"network\":\"device_apple_ida\",\"segments\":[]}}}]}"; JsonElement en1 = new JsonElementConstructor().construct(json1); JsonElement en2 = new JsonElementConstructor().construct(json2); Assert.assertFalse(en1.equals(en2)); }
Example 14
Source File: TestChangeVmPassword.java From zstack with Apache License 2.0 | 5 votes |
@Test public void test() throws ApiSenderException { VmInstanceInventory inv = api.listVmInstances(null).get(0); api.createSystemTag(inv.getUuid(), TestQemuAgentSystemTag.TestSystemTags.qemu.getTagFormat(), VmInstanceVO.class); Assert.assertEquals(VmInstanceState.Running.toString(), inv.getState()); VmAccountPreference account = api.changeVmPassword(new VmAccountPreference( inv.getUuid(), "change", "test1234")); Assert.assertNotNull(account); account = api.changeVmPassword(new VmAccountPreference( inv.getUuid(), "change", "||||||")); Assert.assertNotNull(account); VmInstanceInventory vm = deployer.vms.get("TestVm"); vm = api.stopVmInstance(inv.getUuid()); Assert.assertEquals(VmInstanceState.Stopped.toString(), vm.getState()); try { account = api.changeVmPassword(new VmAccountPreference( inv.getUuid(), "change", "test1234")); Assert.assertFalse(true); } catch (ApiSenderException e) { Assert.assertEquals(VmErrors.NOT_IN_CORRECT_STATE.toString(), e.getError().getCode()); } vm = api.startVmInstance(inv.getUuid()); Assert.assertEquals(VmInstanceState.Running.toString(), vm.getState()); VmInstanceVO vmvo = dbf.findByUuid(inv.getUuid(), VmInstanceVO.class); Assert.assertNotNull(vmvo); Assert.assertEquals(VmInstanceState.Running, vmvo.getState()); Assert.assertNotNull(vmvo.getHostUuid()); }
Example 15
Source File: TestSnapshotOnKvm8.java From zstack with Apache License 2.0 | 4 votes |
@Test public void test() throws ApiSenderException { VmInstanceInventory vm = deployer.vms.get("TestVm"); String volUuid = vm.getRootVolumeUuid(); VolumeSnapshotInventory inv = api.createSnapshot(volUuid); VolumeSnapshotInventory root = inv; fullSnapshot(inv, 0); inv = api.createSnapshot(volUuid); deltaSnapshot(inv, 1); VolumeSnapshotInventory inv0 = api.createSnapshot(volUuid); deltaSnapshot(inv0, 2); api.stopVmInstance(vm.getUuid()); api.revertVolumeToSnapshot(inv.getUuid()); VolumeSnapshotVO vo1 = dbf.findByUuid(inv.getUuid(), VolumeSnapshotVO.class); Assert.assertTrue(vo1.isLatest()); vo1 = dbf.findByUuid(inv0.getUuid(), VolumeSnapshotVO.class); Assert.assertFalse(vo1.isLatest()); VolumeSnapshotInventory inv1 = api.createSnapshot(volUuid); deltaSnapshot(inv1, 2); VolumeSnapshotInventory inv2 = api.createSnapshot(volUuid); deltaSnapshot(inv2, 3); inv = api.createSnapshot(volUuid); deltaSnapshot(inv, 4); inv = api.createSnapshot(volUuid); deltaSnapshot(inv, 5); inv = api.createSnapshot(volUuid); deltaSnapshot(inv, 6); long count = dbf.count(VolumeSnapshotTreeVO.class); Assert.assertEquals(1, count); api.deleteSnapshot(inv0.getUuid()); count = dbf.count(VolumeSnapshotVO.class); Assert.assertEquals(7, count); SimpleQuery<VolumeSnapshotVO> q = dbf.createQuery(VolumeSnapshotVO.class); q.add(VolumeSnapshotVO_.treeUuid, SimpleQuery.Op.EQ, vo1.getTreeUuid()); q.add(VolumeSnapshotVO_.latest, SimpleQuery.Op.EQ, true); count = q.count(); Assert.assertEquals(1, count); VolumeSnapshotVO vo = dbf.findByUuid(inv.getUuid(), VolumeSnapshotVO.class); Assert.assertTrue(vo.isLatest()); VolumeSnapshotTreeVO cvo = dbf.findByUuid(vo.getTreeUuid(), VolumeSnapshotTreeVO.class); Assert.assertTrue(cvo.isCurrent()); Assert.assertEquals(1, nfsConfig.deleteCmds.size()); snapshotKvmSimulator.validate(root); }
Example 16
Source File: RectangledTest.java From JOML with MIT License | 4 votes |
public void testZeroSizeRectangle() { Rectangled rect = new Rectangled(0, 0, 0, 0); Assert.assertFalse(rect.isValid()); }
Example 17
Source File: SequenceIteratorTest.java From consulo with Apache License 2.0 | 4 votes |
public void testAllEmpty() { Assert.assertFalse(ContainerUtil.concatIterators(empty()).hasNext()); Assert.assertFalse(ContainerUtil.concatIterators(empty(), empty()).hasNext()); }
Example 18
Source File: TestGetPrimaryStorageAllocatorStrategies.java From zstack with Apache License 2.0 | 4 votes |
@Test public void test() throws ApiSenderException { List<String> types = api.getPrimaryStorageAllocatorStrategies(); Assert.assertFalse(types.isEmpty()); }
Example 19
Source File: TestCasesBase.java From BigDataScript with Apache License 2.0 | 4 votes |
/** * Check a 'hello.txt' file in an S3 bucket */ void checkS3HelloTxt(String url, String path, String paren) { int objectSize = 12; long lastModified = 1437862027000L; Data d = Data.factory(url); d.setVerbose(verbose); d.setDebug(debug); long lastMod = d.getLastModified().getTime(); if (verbose) Gpr.debug("Path: " + d.getPath() + "\tlastModified: " + lastMod + "\tSize: " + d.size()); // Check some features Assert.assertTrue("Is S3?", d instanceof DataS3); Assert.assertEquals(path, d.getAbsolutePath()); Assert.assertEquals(objectSize, d.size()); Assert.assertEquals(lastModified, d.getLastModified().getTime()); Assert.assertTrue("Is file?", d.isFile()); Assert.assertFalse("Is directory?", d.isDirectory()); // Download file boolean ok = d.download(); Assert.assertTrue("Download OK", ok); Assert.assertTrue("Is downloaded?", d.isDownloaded()); // Is it at the correct local file? Assert.assertEquals("/tmp/bds/s3/pcingola.bds/hello.txt", d.getLocalPath()); Assert.assertEquals(path, d.getAbsolutePath()); Assert.assertEquals(paren, d.getParent().toString()); Assert.assertEquals("hello.txt", d.getName()); // Check last modified time File file = new File(d.getLocalPath()); long lastModLoc = file.lastModified(); Assert.assertTrue("Last modified check:" // + "\n\tlastMod : " + lastMod // + "\n\tlastModLoc : " + lastModLoc // + "\n\tDiff : " + (lastMod - lastModLoc)// , Math.abs(lastMod - lastModLoc) < 2 * DataRemote.CACHE_TIMEOUT); Assert.assertEquals(objectSize, file.length()); }
Example 20
Source File: test_AbstractNodeTester.java From xmlunit with Apache License 2.0 | 4 votes |
public void testProcessingInstruction(ProcessingInstruction instr) { Assert.assertFalse("testProcessingInstruction called", piCalled); piCalled = true; Assert.assertEquals("target", instr.getTarget()); Assert.assertEquals("processing-instruction", instr.getData()); }