GDTCOREndpointsTest.m 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*
  2. * Copyright 2018 Google
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #import <XCTest/XCTest.h>
  17. #import "GoogleDataTransport/GDTCORLibrary/Private/GDTCOREndpoints_Private.h"
  18. #import "GoogleDataTransport/GDTCORLibrary/Public/GoogleDataTransport/GDTCOREndpoints.h"
  19. @interface GDTCOREndpointsTest : XCTestCase
  20. @end
  21. @implementation GDTCOREndpointsTest
  22. /* Verify if the upload URLs are not empty for different endpoints. */
  23. - (void)testUploadURLsAreNotEmpty {
  24. XCTAssertNotNil([GDTCOREndpoints uploadURLForTarget:kGDTCORTargetCCT]);
  25. XCTAssertNotNil([GDTCOREndpoints uploadURLForTarget:kGDTCORTargetFLL]);
  26. XCTAssertNotNil([GDTCOREndpoints uploadURLForTarget:kGDTCORTargetCSH]);
  27. XCTAssertNotNil([GDTCOREndpoints uploadURLForTarget:kGDTCORTargetINT]);
  28. }
  29. /* Verify if the upload URLs are correct for different endpoints. */
  30. - (void)testUploadURLsAreCorrect {
  31. NSDictionary<NSNumber *, NSURL *> *uploadURLs = [GDTCOREndpoints uploadURLs];
  32. XCTAssertEqualObjects([GDTCOREndpoints uploadURLForTarget:kGDTCORTargetCCT],
  33. uploadURLs[@(kGDTCORTargetCCT)]);
  34. XCTAssertEqualObjects([GDTCOREndpoints uploadURLForTarget:kGDTCORTargetFLL],
  35. uploadURLs[@(kGDTCORTargetFLL)]);
  36. XCTAssertEqualObjects([GDTCOREndpoints uploadURLForTarget:kGDTCORTargetCSH],
  37. uploadURLs[@(kGDTCORTargetCSH)]);
  38. XCTAssertEqualObjects([GDTCOREndpoints uploadURLForTarget:kGDTCORTargetINT],
  39. uploadURLs[@(kGDTCORTargetINT)]);
  40. }
  41. @end