-@testable import Vapor
+import Vapor
 import XCTest
 
 class ApplicationTests: XCTestCase {

    }
}

extension Environment {
    static var xcode: Environment {
        return .init(name: "xcode", isRelease: false, arguments: ["xcode"])
    }
}

    ]
}

// MARK: Private

private extension Application {
    // MARK: Static

    static func makeTest(configure: (Router) throws -> ()) throws -> Application {
        let router = EngineRouter.default()
        try configure(router)
        var services = Services.default()
        services.register(router, as: Router.self)
        return try Application.asyncBoot(config: .default(), environment: .xcode, services: services).wait()
    }

    @discardableResult
    func test(
        _ method: HTTPMethod,
        _ path: String,
        beforeSend: @escaping (Request) throws -> () = { _ in },
        afterSend: @escaping (Response) throws -> ()
    ) throws  -> Application {
        let http = HTTPRequest(method: method, url: URL(string: path)!)
        return try test(http, beforeSend: beforeSend, afterSend: afterSend)
    }

    @discardableResult
    func test(
        _ http: HTTPRequest,
        beforeSend: @escaping (Request) throws -> () = { _ in },
        afterSend: @escaping (Response) throws -> ()
    ) throws -> Application {
        let promise = eventLoop.newPromise(Void.self)
        eventLoop.execute {
            let req = Request(http: http, using: self)
            do {
                try beforeSend(req)
                try self.make(Responder.self).respond(to: req).map { res in
                    try afterSend(res)
                }.cascade(promise: promise)
            } catch {
                promise.fail(error: error)
            }
        }
        try promise.futureResult.wait()
        return self
    }

    // MARK: Live

    static func runningTest(port: Int, configure: (Router) throws -> ()) throws -> Application {
        let router = EngineRouter.default()
        try configure(router)
