Authored by 周蓉君

更新Factory的测试样例。Review by 阿瑟。

@@ -11,7 +11,10 @@ @@ -11,7 +11,10 @@
11 #import "OCMock.h" 11 #import "OCMock.h"
12 #import "YHDataFactory.h" 12 #import "YHDataFactory.h"
13 13
14 -@interface YHDataFactoryTests : XCTestCase 14 +@interface YHDataFactoryTests : XCTestCase {
  15 +@private
  16 + YHDataFactory *factory;
  17 +}
15 18
16 @end 19 @end
17 20
@@ -20,16 +23,22 @@ @@ -20,16 +23,22 @@
20 - (void)setUp { 23 - (void)setUp {
21 [super setUp]; 24 [super setUp];
22 // Put setup code here. This method is called before the invocation of each test method in the class. 25 // Put setup code here. This method is called before the invocation of each test method in the class.
  26 + NSLog(@"%@ setUp", self.name);
  27 + factory = [[YHDataFactory alloc] init];
  28 + XCTAssertNotNil(factory, @"Cannot create YHDataFactory instance.");
23 } 29 }
24 30
25 - (void)tearDown { 31 - (void)tearDown {
26 // Put teardown code here. This method is called after the invocation of each test method in the class. 32 // Put teardown code here. This method is called after the invocation of each test method in the class.
27 [super tearDown]; 33 [super tearDown];
  34 + NSLog(@"%@ tearDown", self.name);
28 } 35 }
29 36
30 -- (void)testExample {  
31 - // This is an example of a functional test case.  
32 - XCTAssert(YES, @"Pass"); 37 +- (void)testJsonDictionaryNil {
  38 + NSLog(@"%@ start", self.name);
  39 + YHAnalyItemData *data = [factory makeItemData];
  40 + XCTAssertNil(data, @"YHDataFactory makeItemData must be nil.");
  41 + NSLog(@"%@ end", self.name);
33 } 42 }
34 43
35 @end 44 @end
@@ -11,7 +11,10 @@ @@ -11,7 +11,10 @@
11 #import "OCMock.h" 11 #import "OCMock.h"
12 #import "YHDeviceFactory.h" 12 #import "YHDeviceFactory.h"
13 13
14 -@interface YHDeviceFactoryTests : XCTestCase 14 +@interface YHDeviceFactoryTests : XCTestCase {
  15 +@private
  16 + YHDeviceFactory *factory;
  17 +}
15 18
16 @end 19 @end
17 20
@@ -20,16 +23,22 @@ @@ -20,16 +23,22 @@
20 - (void)setUp { 23 - (void)setUp {
21 [super setUp]; 24 [super setUp];
22 // Put setup code here. This method is called before the invocation of each test method in the class. 25 // Put setup code here. This method is called before the invocation of each test method in the class.
  26 + NSLog(@"%@ setUp", self.name);
  27 + factory = [[YHDeviceFactory alloc] init];
  28 + XCTAssertNotNil(factory, @"Cannot create YHDeviceFactory instance.");
23 } 29 }
24 30
25 - (void)tearDown { 31 - (void)tearDown {
26 // Put teardown code here. This method is called after the invocation of each test method in the class. 32 // Put teardown code here. This method is called after the invocation of each test method in the class.
27 [super tearDown]; 33 [super tearDown];
  34 + NSLog(@"%@ tearDown", self.name);
28 } 35 }
29 36
30 -- (void)testExample {  
31 - // This is an example of a functional test case.  
32 - XCTAssert(YES, @"Pass"); 37 +- (void)testJsonDictionaryNotNil {
  38 + NSLog(@"%@ start", self.name);
  39 + YHAnalyItemData *data = [factory makeItemData];
  40 + XCTAssertNotNil(data, @"YHDeviceFactory makeItemData can't be nil.");
  41 + NSLog(@"%@ end", self.name);
33 } 42 }
34 43
35 @end 44 @end
@@ -11,7 +11,10 @@ @@ -11,7 +11,10 @@
11 #import "OCMock.h" 11 #import "OCMock.h"
12 #import "YHErrorFactory.h" 12 #import "YHErrorFactory.h"
13 13
14 -@interface YHErrorFactoryTests : XCTestCase 14 +@interface YHErrorFactoryTests : XCTestCase {
  15 +@private
  16 + YHErrorFactory *factory;
  17 +}
15 18
16 @end 19 @end
17 20
@@ -20,16 +23,22 @@ @@ -20,16 +23,22 @@
20 - (void)setUp { 23 - (void)setUp {
21 [super setUp]; 24 [super setUp];
22 // Put setup code here. This method is called before the invocation of each test method in the class. 25 // Put setup code here. This method is called before the invocation of each test method in the class.
  26 + NSLog(@"%@ setUp", self.name);
  27 + factory = [[YHErrorFactory alloc] init];
  28 + XCTAssertNotNil(factory, @"Cannot create YHErrorFactory instance.");
23 } 29 }
24 30
25 - (void)tearDown { 31 - (void)tearDown {
26 // Put teardown code here. This method is called after the invocation of each test method in the class. 32 // Put teardown code here. This method is called after the invocation of each test method in the class.
27 [super tearDown]; 33 [super tearDown];
  34 + NSLog(@"%@ tearDown", self.name);
28 } 35 }
29 36
30 -- (void)testExample {  
31 - // This is an example of a functional test case.  
32 - XCTAssert(YES, @"Pass"); 37 +- (void)testJsonDictionaryNotNil {
  38 + NSLog(@"%@ start", self.name);
  39 + YHAnalyItemData *data = [factory makeItemData];
  40 + XCTAssertNotNil(data, @"YHErrorFactory makeItemData can't be nil.");
  41 + NSLog(@"%@ end", self.name);
33 } 42 }
34 43
35 @end 44 @end
@@ -11,7 +11,10 @@ @@ -11,7 +11,10 @@
11 #import "OCMock.h" 11 #import "OCMock.h"
12 #import "YHEventFactory.h" 12 #import "YHEventFactory.h"
13 13
14 -@interface YHEventFactoryTests : XCTestCase 14 +@interface YHEventFactoryTests : XCTestCase {
  15 +@private
  16 + YHEventFactory *factory;
  17 +}
15 18
16 @end 19 @end
17 20
@@ -20,16 +23,22 @@ @@ -20,16 +23,22 @@
20 - (void)setUp { 23 - (void)setUp {
21 [super setUp]; 24 [super setUp];
22 // Put setup code here. This method is called before the invocation of each test method in the class. 25 // Put setup code here. This method is called before the invocation of each test method in the class.
  26 + NSLog(@"%@ setUp", self.name);
  27 + factory = [[YHEventFactory alloc] init];
  28 + XCTAssertNotNil(factory, @"Cannot create YHEventFactory instance.");
23 } 29 }
24 30
25 - (void)tearDown { 31 - (void)tearDown {
26 // Put teardown code here. This method is called after the invocation of each test method in the class. 32 // Put teardown code here. This method is called after the invocation of each test method in the class.
27 [super tearDown]; 33 [super tearDown];
  34 + NSLog(@"%@ tearDown", self.name);
28 } 35 }
29 36
30 -- (void)testExample {  
31 - // This is an example of a functional test case.  
32 - XCTAssert(YES, @"Pass"); 37 +- (void)testJsonDictionaryNotNil {
  38 + NSLog(@"%@ start", self.name);
  39 + YHAnalyItemData *data = [factory makeItemData];
  40 + XCTAssertNotNil(data, @"YHEventFactory makeItemData can't be nil.");
  41 + NSLog(@"%@ end", self.name);
33 } 42 }
34 43
35 @end 44 @end
@@ -11,7 +11,10 @@ @@ -11,7 +11,10 @@
11 #import "OCMock.h" 11 #import "OCMock.h"
12 #import "YHStatusFactory.h" 12 #import "YHStatusFactory.h"
13 13
14 -@interface YHStatusFactoryTests : XCTestCase 14 +@interface YHStatusFactoryTests : XCTestCase {
  15 +@private
  16 + YHStatusFactory *factory;
  17 +}
15 18
16 @end 19 @end
17 20
@@ -20,16 +23,22 @@ @@ -20,16 +23,22 @@
20 - (void)setUp { 23 - (void)setUp {
21 [super setUp]; 24 [super setUp];
22 // Put setup code here. This method is called before the invocation of each test method in the class. 25 // Put setup code here. This method is called before the invocation of each test method in the class.
  26 + NSLog(@"%@ setUp", self.name);
  27 + factory = [[YHStatusFactory alloc] init];
  28 + XCTAssertNotNil(factory, @"Cannot create YHStatusFactory instance.");
23 } 29 }
24 30
25 - (void)tearDown { 31 - (void)tearDown {
26 // Put teardown code here. This method is called after the invocation of each test method in the class. 32 // Put teardown code here. This method is called after the invocation of each test method in the class.
27 [super tearDown]; 33 [super tearDown];
  34 + NSLog(@"%@ tearDown", self.name);
28 } 35 }
29 36
30 -- (void)testExample {  
31 - // This is an example of a functional test case.  
32 - XCTAssert(YES, @"Pass"); 37 +- (void)testJsonDictionaryNotNil {
  38 + NSLog(@"%@ start", self.name);
  39 + YHAnalyItemData *data = [factory makeItemData];
  40 + XCTAssertNotNil(data, @"YHStatusFactory makeItemData can't be nil.");
  41 + NSLog(@"%@ end", self.name);
33 } 42 }
34 43
35 @end 44 @end