kiwi

【并发那些事】线程有序化神器CompletionService

安稳与你 提交于 2020-02-27 02:55:12
<a name="C2O7X"></a> 前言 话说有一天,产品经理突然找到正在摸鱼的你。<br> <br>产品:『我们要加一个聚合搜索功能,当用户在我们网站查询一件商品时,我们分别从 A、B、C 三个网站上查询这个信息,然后再把得到的结果返回给用户』<br> <br>你:『哦,就是写个爬虫,从 3 个网站上抓取数据是吧?』<br> <br>产品:『呸,爬虫是犯法的,这叫数据分析,怎么样,能实现吧?』<br> <br>你:『可以』<br> <br>产品:『好的,明天上线』<br> <br>你:『。。。』<br> <a name="OIfSG"></a> Code 1.0 你很快完成了开发,代码如下:<br> /* * * * * * * * blog.coder4j.cn * * * Copyright (C) B0A6-B0B0 All Rights Reserved. * * * */ package cn.coder4j.study.example.thread; import cn.hutool.core.thread.ThreadUtil; import com.google.common.collect.Lists; import java.util.List; /** * @author buhao * @version TestCompletionService

Cannot run tests on Xcode 6 Beta 5

坚强是说给别人听的谎言 提交于 2020-01-12 07:14:10
问题 I have an iOS project that is using the Kiwi testing framework (latest version 2.3.0 which I installed from cocoapods). At first when I ran the tests I received an error that it cannot find XCTest.h. So I followed the advice on this answer: https://stackoverflow.com/a/24651704/1082326 and the problem went away. However a different problem arise, now when I try to run the tests when the simulator selected is "iPhone 5 (8.0)" then I get the following error: IDEBundleInjection.c: Error 3587

How does one unit test code that interacts with the Core Bluetooth APIs?

时光毁灭记忆、已成空白 提交于 2019-12-23 12:36:30
问题 I would like to unit test a class that acts as a CBPeripheralManagerDelegate to the CBPeripheralManager class. Typically, in order to stub out an external class dependency, I would use either a form of dependency injection by passing in via the class initializer or via a property. When dealing with singleton-based API's, I have been able to use libraries like Kiwi to stub the class level method that returns the singleton (i.e. [ClassName stub:@selector(sharedInstance) andReturn

Mocking expectations in Kiwi (iOS) for a delegate

偶尔善良 提交于 2019-12-23 12:18:42
问题 Short version of the question: What is wrong with the following Kiwi/iOS mock expectation? [[mockDelegate should] receive:@selector(connectionDidSucceedWithText:andStatus:) withArguments:[testString1 stringByAppendingString:testString2],theValue(value),nil]; Long version of question: I am trying to write a test in Kiwi, iOS for a simple class that handles a NSConnection. To test that the class handles the callback from the NSConnection I send it the delegate methods NSConnection normally does

Strange ordering of Kiwi iOS context blocks

妖精的绣舞 提交于 2019-12-22 09:47:42
问题 I have a Kiwi spec file that looks something like this: #import "Kiwi.h" #import "MyCollection.h" SPEC_BEGIN(CollectionSpec) describe(@"Collection starting with no objects", ^{ MyCollection *collection = [MyCollection new]; context(@"then adding 1 object", ^{ MyObject *object = [MyObject new]; [collection addObject:object]; it(@"has 1 object", ^{ [collection shouldNotBeNil]; [collection.objects shouldNotBeNil]; [[theValue(collection.objects.count) should] equal:theValue(1)]; //failing test })

platform of the target `fubarTests` (iOS 4.3) is not compatible with `Kiwi (2.2.1)` which has a minimum requirement of iOS 5.0

我的梦境 提交于 2019-12-08 14:50:51
问题 I can't seem to get past this error and don't know why. I'm running xcode 4.6.3 The project's ios deployment target says iOS 6.1 the base sdk is 6.1 My Podfile is: # Podfile platform :ios target :fubarTests, :exclusive => true do pod 'Kiwi' end and when I try to run pod install from the command line I get the error about the target being iOS 4.3. Why does it think my target is 4.3 and how can I change it? 回答1: You need to specify platform :ios, '6.1' 回答2: It's no longer necessary to specify

Strange ordering of Kiwi iOS context blocks

∥☆過路亽.° 提交于 2019-12-06 01:21:17
I have a Kiwi spec file that looks something like this: #import "Kiwi.h" #import "MyCollection.h" SPEC_BEGIN(CollectionSpec) describe(@"Collection starting with no objects", ^{ MyCollection *collection = [MyCollection new]; context(@"then adding 1 object", ^{ MyObject *object = [MyObject new]; [collection addObject:object]; it(@"has 1 object", ^{ [collection shouldNotBeNil]; [collection.objects shouldNotBeNil]; [[theValue(collection.objects.count) should] equal:theValue(1)]; //failing test }); context(@"then removing 1 object", ^{ [collection removeObject:object]; it(@"has 0 objects", ^{ [

Cannot run tests on Xcode 6 Beta 5

吃可爱长大的小学妹 提交于 2019-12-03 12:28:46
I have an iOS project that is using the Kiwi testing framework (latest version 2.3.0 which I installed from cocoapods). At first when I ran the tests I received an error that it cannot find XCTest.h. So I followed the advice on this answer: https://stackoverflow.com/a/24651704/1082326 and the problem went away. However a different problem arise, now when I try to run the tests when the simulator selected is "iPhone 5 (8.0)" then I get the following error: IDEBundleInjection.c: Error 3587 loading bundle '/Users/ifeins/Library/Developer/Xcode/DerivedData/teacup- aaenoytmfpqpgmaebqotyfrutlxy

Kiwi and CocoaPods with a static shared library

 ̄綄美尐妖づ 提交于 2019-12-01 23:15:57
问题 I have a workspace with 3 projects: MyApp Common Pods Common is a common library that MyApp depends on. I'd like to setup CocoaPods and Kiwi to work correctly in this project. How do I go about this? I found https://stackoverflow.com/a/16472563/62, but when I try to follow this approach, I get an error when building MyApp before I even try adding Kiwi: ld: library not found for -lPods Here's the repo on GitHub: https://github.com/lyahdav/cocoapods_kiwi_shared_library My Podfile is: workspace

Kiwi and CocoaPods with a static shared library

陌路散爱 提交于 2019-12-01 21:52:23
I have a workspace with 3 projects: MyApp Common Pods Common is a common library that MyApp depends on. I'd like to setup CocoaPods and Kiwi to work correctly in this project. How do I go about this? I found https://stackoverflow.com/a/16472563/62 , but when I try to follow this approach, I get an error when building MyApp before I even try adding Kiwi: ld: library not found for -lPods Here's the repo on GitHub: https://github.com/lyahdav/cocoapods_kiwi_shared_library My Podfile is: workspace 'MyApp.xcworkspace' platform :ios, '7.0' target 'Common' do xcodeproj 'Common/Common.xcodeproj' pod