<commit_before>// Copyright (c) 2013, the Clean project authors.  Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

library request_handler_test.dart;

import 'package:unittest/unittest.dart';
import 'package:clean_ajax/server.dart';
import 'package:unittest/mock.dart';
import 'dart:async';
import 'dart:convert';
import 'dart:io';
import 'package:http_server/http_server.dart';
import 'package:clean_backend/clean_backend.dart' show Request;

class MockHttpBody extends Mock implements HttpBody {}
class MockHttpResponse extends Mock implements HttpResponse {}
class MockHttpHeaders extends Mock implements HttpHeaders {}

class MockHttpRequest extends Mock implements HttpRequest {
  Mock httpBody = new MockHttpBody();
  Mock httpResponse = new MockHttpResponse();
  Mock httpHeaders = new MockHttpHeaders();
  MockHttpRequest(String body) {
    httpBody.when(callsTo('get body')).alwaysReturn(body);
    when(callsTo('get response')).alwaysReturn(httpResponse);
    httpResponse.when(callsTo('get headers')).alwaysReturn(httpHeaders);
  }
}


Future mockHttpBodyExctractor(MockHttpRequest request) =>
    new Future.value(request.httpBody);

void main() {

  group('MultiRequestHandler', () {
    MultiRequestHandler requestHandler;

    setUp(() {
      requestHandler = new MultiRequestHandler();<commit_msg>Fixed JSON/String incompatibility in tests.<commit_after>// Copyright (c) 2013, the Clean project authors.  Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

library request_handler_test.dart;

import 'package:unittest/unittest.dart';
import 'package:clean_ajax/server.dart';
import 'package:unittest/mock.dart';
import 'dart:async';
import 'dart:convert';
import 'dart:io';
import 'package:http_server/http_server.dart';
import 'package:clean_backend/clean_backend.dart' show Request;

class MockHttpBody extends Mock implements HttpBody {}
class MockHttpResponse extends Mock implements HttpResponse {}
class MockHttpHeaders extends Mock implements HttpHeaders {}

class MockHttpRequest extends Mock implements HttpRequest {
  Mock httpBody = new MockHttpBody();
  Mock httpResponse = new MockHttpResponse();
  Mock httpHeaders = new MockHttpHeaders();
  MockHttpRequest(String body) {
    httpBody.when(callsTo('get body')).alwaysReturn(JSON.decode(body));
    when(callsTo('get response')).alwaysReturn(httpResponse);
    httpResponse.when(callsTo('get headers')).alwaysReturn(httpHeaders);
  }
}


Future mockHttpBodyExctractor(MockHttpRequest request) =>
    new Future.value(request.httpBody);

void main() {

  group('MultiRequestHandler', () {
    MultiRequestHandler requestHandler;

    setUp(() {
      requestHandler = new MultiRequestHandler();
{'fraction_non_alphanumeric': 0.10147918816649466, 'fraction_numerical': 0.0027519779841761265, 'mean_word_length': 5.700460829493087, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6799736', 'n_tokens_mistral': 805, 'n_tokens_neox': 800, 'n_words': 233}