You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: MDCBottomNavigationBarControllerDelegateTests.m
    path of file: ./repos/material-components-ios/components/BottomNavigation/tests/unit
    
    the code of the file until where you have to start completion: // Copyright 2020-present the Material Components for iOS authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance
    
function correctly. */
@interface MDCBottomNavigationBarControllerDelegateTests : XCTestCase

/** Controller for testing. */
@property(nonatomic, strong) MDCBottomNavigationBarController *controller;

@end

@implementation MDCBottomNavigationBarControllerDelegateTests

- (void)setUp {
  [super setUp];

  self.controller = [[MDCBottomNavigationBarController alloc] init];
  NSMutableArray<UIViewController *> *viewControllers = [NSMutableArray array];
  [viewControllers addObject:[[UIViewController alloc] init]];
  [viewControllers addObject:[[UIViewController alloc] init]];
  [viewControllers addObject:[[UIViewController alloc] init]];
  [viewControllers addObject:[[UIViewController alloc] init]];
  self.controller.viewControllers = [viewControllers copy];

  self.controller.view.bounds = CGRectMake(0, 0, 320, 72);
  [self.controller.view layoutIfNeeded];
}

- (void)tearDown {
  self.controller = nil;

  [super tearDown];
}

- (void)testNoOptionalsDelegate {
  // Given
  MDCBottomNavigationBarControllerDelegateWithNoOptionals *delegate =
      [[MDCBottomNavigationBarControllerDelegateWithNoOptionals alloc] init];
  self.controller.selectedIndex = 0;

  // When
  self.controller.delegate = delegate;
  XCTAssertNoThrow([self.controller.navigationBar.delegate
      bottomNavigationBar:self.controller.navigationBar
         shouldSelectItem:self.controller.navigationBar.items.lastObject]);
  XCTAssertNoThrow([self.controller.navigationBar.delegate
      bottomNavigationBar:self.controller.navigationBar
            didSelectItem:self.controller.navigationBar.items.lastObject]);
}

- (void)testOnlyDidSelectDelegate {
  // Given
  MDCBottomNavigationBarControllerDelegateWithOnlyDidSelect *delegate =
      [[MDCBottomNavigationBarControllerDelegateWithOnlyDidSelect alloc] init];
  self.controller.selectedIndex = 0;

  // When
  self.controller.delegate = delegate;
  XCTAssertNoThrow([self.controller.navigationBar.delegate
      bottomNavigationBar:self.controller.navigationBar
         shouldSelectItem:self.controller.navigationBar.items.lastObject]);
  XCTAssertNoThrow([self.controller.navigationBar.delegate
      bottomNavigationBar:self.controller.navigationBar
            didSelectItem:self.controller.navigationBar.items.lastObject]);

  // Then
  XCTAssertTrue(delegate.didSelectViewControllerWasCalled);
}

- (void)testOnlyShouldSelectDelegate {
  // Given
  MDCBottomNavigationBarControllerDelegateWithOnlyShouldSelect *delegate =
      [[MDCBottomNavigationBarControllerDelegateWithOnlyShouldSelect alloc] init];
  self.controller.selectedIndex = 0;

  // When
  self.controller.delegate = delegate;
  XCTAssertNoThrow([self.controller.navigationBar.delegate
      bottomNavigationBar:self.controller.navigationBar
         shouldSelectItem:self.controller.navigationBar.items.lastObject]);
  XCTAssertNoThrow([self.controller.navigationBar.delegate
      bottomNavigationBar:self.controller.navigationBar
            didSelectItem:self.controller.navigationBar.items.lastObject]);

  // Then
  XCTAssertTrue(delegate.shouldSelectViewControllerWasCalled);
}

- (void)testAllOptionalsDelegate {
  // Given
  MDCBottomNavigationBarControllerDelegateWithAllOptionals *delegate =
      [[MDCBottomNavigationBarControllerDelegateWithAllOptionals alloc] init];
  self.controller.selectedIndex = 0;

  // When
  self.controller.delegate = delegate;
  XCTAssertNoThrow([self.controller.navigationBar.delegate
      bottomNavigationBar:self.controller.navigationBar
         shouldSelectItem:self.controller.navigationBar.items.lastObject]);
  XCTAssertNoThrow([self.controller.navigationBar.delegate
      bottomNavigationBar:self.controller.navigationBar
            didSelectItem:self.controller.navigationBar.items.lastObject]);

  // Then
  XCTAssertTrue(delegate.shouldSelectViewControllerWasCalled);
  XCTAssertTrue(delegate.didSelectViewControllerWasCalled);
}

@end