If you have a test class, and you just want to define another class within it (say for test purposes), define an interface and an implementation near the bottom of the test file. Like this. Note the order here matters. Define the test class first in the file, before you use it in the test (objective-c!).


#import <XCTest/XCTest.h>
#import "SPTAppRemoteServerConnector.h"

// test class to act as the delegate

@interface FakeConnector : NSObject

@end

@interface FakeConnector () <SPTAppRemoteServerConnectorDelegate>

@end


@implementation FakeConnector
- (void)didConnectWithServer
{

}
@end



@interface SPTAppRemoteServerConnectorTests : XCTestCase

@end

@implementation SPTAppRemoteServerConnectorTests

- (void)setUp
{
    [super setUp];
}

- (void)testDelegateGetsFiredWhenServerConnects
{
    FakeConnector *fake = [FakeConnector new];
    fake = nil;

    SPTAppRemoteServerConnector *connector = [SPTAppRemoteServerConnector new];
    connector = nil;
}


@end