Skip to content

Commit d580c13

Browse files
Hongyan JiangGitHub Enterprise
authored andcommitted
Fix unit test cases
1 parent 9bde7d3 commit d580c13

File tree

3 files changed

+20
-20
lines changed

3 files changed

+20
-20
lines changed

Tests/InstanaAgentTests/Beacons/ReporterTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -816,7 +816,7 @@ class ReporterTests: InstanaTestCase {
816816
AssertTrue(beacon.viewName == nil)
817817
AssertTrue(mockSession.propertyHandler.properties.view == nil)
818818
AssertTrue(mockSession.propertyHandler.properties.user == nil)
819-
AssertTrue(mockSession.propertyHandler.properties.metaData.isEmpty)
819+
AssertTrue(mockSession.propertyHandler.properties.getMetaData().isEmpty)
820820
AssertTrue(reporter.preQueue.count == 1)
821821

822822
// When

Tests/InstanaAgentTests/Configuration/InstanaPropertyHandlerTests.swift

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ class InstanaPropertyHandlerTests: InstanaTestCase {
3333
}
3434

3535
// Then
36-
AssertTrue(properties.metaData.keys.count == max)
37-
AssertTrue(properties.metaData.values.count == max)
36+
AssertTrue(properties.getMetaData().keys.count == max)
37+
AssertTrue(properties.getMetaData().values.count == max)
3838
}
3939

4040
func test_validate_keys_one_overflow() {
@@ -50,8 +50,8 @@ class InstanaPropertyHandlerTests: InstanaTestCase {
5050
}
5151

5252
// Then
53-
AssertTrue(properties.metaData.keys.count == keys.count - 1)
54-
AssertTrue(properties.metaData.keys.count == max)
53+
AssertTrue(properties.getMetaData().keys.count == keys.count - 1)
54+
AssertTrue(properties.getMetaData().keys.count == max)
5555
}
5656

5757
func test_validate_value_valid() {
@@ -94,8 +94,8 @@ class InstanaPropertiesTests: XCTestCase {
9494
properties.appendMetaData("Key", "Value")
9595

9696
// Then
97-
XCTAssertEqual(properties.metaData["Key"], "Value")
98-
XCTAssertTrue(properties.metaData.count == 1)
97+
XCTAssertEqual(properties.getMetaData()["Key"], "Value")
98+
XCTAssertTrue(properties.getMetaData().count == 1)
9999
}
100100

101101
func test_appendMetaData_exceeds_length() {
@@ -111,9 +111,9 @@ class InstanaPropertiesTests: XCTestCase {
111111
// Then
112112
let expectedKey = key.cleanEscapeAndTruncate(at: key.count - 1)
113113
let expectedValue = value.cleanEscapeAndTruncate(at: value.count - 1)
114-
XCTAssertEqual(properties.metaData[expectedKey], expectedValue)
115-
XCTAssertEqual(properties.metaData[expectedKey]?.last, "")
116-
XCTAssertTrue(properties.metaData.count == 1)
114+
XCTAssertEqual(properties.getMetaData()[expectedKey], expectedValue)
115+
XCTAssertEqual(properties.getMetaData()[expectedKey]?.last, "")
116+
XCTAssertTrue(properties.getMetaData().count == 1)
117117
}
118118

119119
func test_view_valid_length() {

Tests/InstanaAgentTests/InstanaTests.swift

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ class InstanaTests: InstanaTestCase {
306306
Instana.setMeta(value: given["Key2"]!, key: "Key2")
307307

308308
// Then
309-
AssertEqualAndNotNil(Instana.current?.session.propertyHandler.properties.metaData, given)
309+
AssertEqualAndNotNil(Instana.current?.session.propertyHandler.properties.getMetaData(), given)
310310
}
311311

312312
func test_setMetaData_value_exceeds_max() {
@@ -320,9 +320,9 @@ class InstanaTests: InstanaTestCase {
320320
Instana.setMeta(value: exceeds, key: "exceeds")
321321

322322
// Then
323-
AssertEqualAndNotNil(Instana.current?.session.propertyHandler.properties.metaData["valid"], valid)
324-
AssertEqualAndNotNil(Instana.current?.session.propertyHandler.properties.metaData["exceeds"], exceeds.cleanEscapeAndTruncate(at: max))
325-
AssertTrue(Instana.current?.session.propertyHandler.properties.metaData.count == 2)
323+
AssertEqualAndNotNil(Instana.current?.session.propertyHandler.properties.getMetaData()["valid"], valid)
324+
AssertEqualAndNotNil(Instana.current?.session.propertyHandler.properties.getMetaData()["exceeds"], exceeds.cleanEscapeAndTruncate(at: max))
325+
AssertTrue(Instana.current?.session.propertyHandler.properties.getMetaData().count == 2)
326326
}
327327

328328
func test_setMetaData_key_exceeds_max() {
@@ -336,9 +336,9 @@ class InstanaTests: InstanaTestCase {
336336
Instana.setMeta(value: "exceeds", key: exceeds)
337337

338338
// Then
339-
AssertEqualAndNotNil(Instana.current?.session.propertyHandler.properties.metaData[valid], "valid")
340-
AssertEqualAndNotNil(Instana.current?.session.propertyHandler.properties.metaData[exceeds.cleanEscapeAndTruncate(at: max)], "exceeds")
341-
AssertTrue(Instana.current?.session.propertyHandler.properties.metaData.count == 2)
339+
AssertEqualAndNotNil(Instana.current?.session.propertyHandler.properties.getMetaData()[valid], "valid")
340+
AssertEqualAndNotNil(Instana.current?.session.propertyHandler.properties.getMetaData()[exceeds.cleanEscapeAndTruncate(at: max)], "exceeds")
341+
AssertTrue(Instana.current?.session.propertyHandler.properties.getMetaData().count == 2)
342342
}
343343

344344
func test_setMetaData_ignore_too_many_fields() {
@@ -351,14 +351,14 @@ class InstanaTests: InstanaTestCase {
351351
}
352352

353353
// Then
354-
let values = Array(Instana.current!.session.propertyHandler.properties.metaData.values)
355-
let keys = Array(Instana.current!.session.propertyHandler.properties.metaData.keys)
354+
let values = Array(Instana.current!.session.propertyHandler.properties.getMetaData().values)
355+
let keys = Array(Instana.current!.session.propertyHandler.properties.getMetaData().keys)
356356
AssertTrue(values.contains("V-0") == true)
357357
AssertTrue(values.contains("V-63") == true)
358358
AssertTrue(values.contains("V-64") == false)
359359
AssertTrue(keys.contains("63") == true)
360360
AssertTrue(keys.contains("64") == false)
361-
AssertTrue(Instana.current!.session.propertyHandler.properties.metaData.count == max)
361+
AssertTrue(Instana.current!.session.propertyHandler.properties.getMetaData().count == max)
362362
}
363363

364364
func test_setIgnoreURLs() {

0 commit comments

Comments
 (0)