Skip to content

Commit 22a9751

Browse files
committed
Merge pull request #56 from ParsePlatform/nlutsenko.assertions
Cleanup test assertions descriptions.
2 parents be24dbf + a8d2ee2 commit 22a9751

File tree

5 files changed

+22
-31
lines changed

5 files changed

+22
-31
lines changed

Tests/Unit/InstallationUnitTests.m

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,24 +27,18 @@ - (void)testInstallationImmutableFieldsCannotBeChanged {
2727
PFInstallation *installation = [PFInstallation currentInstallation];
2828
installation.deviceToken = @"11433856eed2f1285fb3aa11136718c1198ed5647875096952c66bf8cb976306";
2929

30-
PFAssertThrowsInvalidArgumentException(installation[@"deviceType"] = @"android",
31-
@"Should throw an exception for trying to change deviceType.");
32-
PFAssertThrowsInvalidArgumentException(installation[@"installationId"] = @"a"
33-
@"Should throw an exception for trying to change installationId.");
34-
PFAssertThrowsInvalidArgumentException(installation[@"localeIdentifier"] = @"a"
35-
@"Should throw an exception for trying to change installationId.");
30+
PFAssertThrowsInvalidArgumentException(installation[@"deviceType"] = @"android");
31+
PFAssertThrowsInvalidArgumentException(installation[@"installationId"] = @"a");
32+
PFAssertThrowsInvalidArgumentException(installation[@"localeIdentifier"] = @"a");
3633
}
3734

3835
- (void)testInstallationImmutableFieldsCannotBeDeleted {
3936
PFInstallation *installation = [PFInstallation currentInstallation];
4037
installation.deviceToken = @"11433856eed2f1285fb3aa11136718c1198ed5647875096952c66bf8cb976306";
4138

42-
PFAssertThrowsInvalidArgumentException([installation removeObjectForKey:@"deviceType"],
43-
@"Should throw an exception for trying to delete deviceType.");
44-
PFAssertThrowsInvalidArgumentException([installation removeObjectForKey:@"installationId"],
45-
@"Should throw an exception for trying to delete installationId.");
46-
PFAssertThrowsInvalidArgumentException([installation removeObjectForKey:@"localeIdentifier"],
47-
@"Should throw an exception for trying to delete installationId.");
39+
PFAssertThrowsInvalidArgumentException([installation removeObjectForKey:@"deviceType"]);
40+
PFAssertThrowsInvalidArgumentException([installation removeObjectForKey:@"installationId"]);
41+
PFAssertThrowsInvalidArgumentException([installation removeObjectForKey:@"localeIdentifier"]);
4842
}
4943

5044
@end

Tests/Unit/ObjectSubclassTests.m

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -147,12 +147,12 @@ - (void)testExplicitConstructor {
147147

148148
- (void)testSubclassConstructor {
149149
PFObject *theFlash = [PFObject objectWithClassName:@"Person"];
150-
XCTAssertFalse([theFlash isKindOfClass:[TheFlash class]], @"We're living the past.");
150+
XCTAssertFalse([theFlash isKindOfClass:[TheFlash class]]);
151151

152152
[TheFlash registerSubclass];
153153
theFlash = [PFObject objectWithClassName:@"Person"];
154-
XCTAssertTrue([theFlash isKindOfClass:[TheFlash class]], @"In the future, everyone is the Flash.");
155-
XCTAssertEqualObjects(@"The Flash", [(TheFlash*)theFlash flashName], @"The Flash's name should be The Flash, duh.");
154+
XCTAssertTrue([theFlash isKindOfClass:[TheFlash class]]);
155+
XCTAssertEqualObjects(@"The Flash", [(TheFlash*)theFlash flashName]);
156156
}
157157

158158
- (void)testSubclassesMustHaveTheirParentsParseClassName {
@@ -162,8 +162,7 @@ - (void)testSubclassesMustHaveTheirParentsParseClassName {
162162

163163
- (void)testDirtyPointerDetection {
164164
[ClassWithDirtyingConstructor registerSubclass];
165-
XCTAssertThrows([ClassWithDirtyingConstructor objectWithoutDataWithObjectId:@"NotUsed"],
166-
@"ClassWithDirtyingConstructor has an invalid init method");
165+
XCTAssertThrows([ClassWithDirtyingConstructor objectWithoutDataWithObjectId:@"NotUsed"]);
167166
[PFObject unregisterSubclass:[ClassWithDirtyingConstructor class]];
168167
}
169168

Tests/Unit/ObjectUnitTests.m

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -69,20 +69,19 @@ - (void)testConstructorFromDictionary {
6969
@"object" : object };
7070
PFObject *object2 = [PFObject objectWithClassName:@"Test" dictionary:validDictionary];
7171
XCTAssertNotNil(object2);
72-
XCTAssertEqualObjects(string, object2[@"string"], @"'string' should be set via constructor");
73-
XCTAssertEqualObjects(number, object2[@"number"], @"'number' should be set via constructor");
74-
XCTAssertEqualObjects(date, object2[@"date"], @"'date' should be set via constructor");
75-
XCTAssertEqualObjects(object, object2[@"object"], @"'object' should be set via constructor");
76-
XCTAssertEqualObjects(null, object2[@"null"], @"'null' should be set via constructor");
77-
XCTAssertEqualObjects(data, object2[@"data"], @"'data' should be set via constructor");
72+
XCTAssertEqualObjects(string, object2[@"string"]);
73+
XCTAssertEqualObjects(number, object2[@"number"]);
74+
XCTAssertEqualObjects(date, object2[@"date"]);
75+
XCTAssertEqualObjects(object, object2[@"object"]);
76+
XCTAssertEqualObjects(null, object2[@"null"]);
77+
XCTAssertEqualObjects(data, object2[@"data"]);
7878

7979
validDictionary = @{ @"array" : @[ object, object2 ],
8080
@"dictionary" : @{@"bar" : date, @"score" : number} };
8181
PFObject *object3 = [PFObject objectWithClassName:@"Stuff" dictionary:validDictionary];
8282
XCTAssertNotNil(object3);
83-
XCTAssertEqualObjects(validDictionary[@"array"], object3[@"array"], @"'array' should be set via constructor");
84-
XCTAssertEqualObjects(validDictionary[@"dictionary"], object3[@"dictionary"],
85-
@"'dictionary' should be set via constructor");
83+
XCTAssertEqualObjects(validDictionary[@"array"], object3[@"array"]);
84+
XCTAssertEqualObjects(validDictionary[@"dictionary"], object3[@"dictionary"]);
8685

8786
// Dictionary constructor relise on constraints enforced by PFObject -setObject:forKey:
8887
NSDictionary *invalidDictionary = @{ @"1" : @"2",

Tests/Unit/ParseModuleUnitTests.m

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ - (void)testModuleSelectors {
4141
// Spin the run loop, as the delegate messages are being called on the main thread
4242
[[NSRunLoop currentRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:1.0]];
4343

44-
XCTAssertTrue(module.didInitializeCalled, @"Did initialize method should be called on a module.");
44+
XCTAssertTrue(module.didInitializeCalled);
4545
}
4646

4747
- (void)testWeakModuleReference {
@@ -53,7 +53,7 @@ - (void)testWeakModuleReference {
5353
}
5454

5555
[collection parseDidInitializeWithApplicationId:nil clientKey:nil];
56-
XCTAssertEqual([collection modulesCount], 0, @"Module should be removed from the collection.");
56+
XCTAssertEqual([collection modulesCount], 0);
5757
}
5858

5959
- (void)testModuleRemove {
@@ -69,7 +69,7 @@ - (void)testModuleRemove {
6969

7070
XCTAssertTrue([collection containsModule:moduleB]);
7171
XCTAssertFalse([collection containsModule:moduleA]);
72-
XCTAssertEqual([collection modulesCount], 1, @"Module should be removed from the collection");
72+
XCTAssertEqual([collection modulesCount], 1);
7373
}
7474

7575
- (void)testNilModule {

Tests/Unit/UserUnitTests.m

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ @implementation UserUnitTests
2121
///--------------------------------------
2222

2323
- (void)testConstructorsClassNameValidation {
24-
PFAssertThrowsInvalidArgumentException([[PFUser alloc] initWithClassName:@"notuserclass"],
25-
@"Should throw an exception for invalid classname");
24+
PFAssertThrowsInvalidArgumentException([[PFUser alloc] initWithClassName:@"notuserclass"]);
2625
}
2726

2827
- (void)testImmutableFieldsCannotBeChanged {

0 commit comments

Comments
 (0)