This document discusses various topics related to unit testing, including different unit testing frameworks for different programming languages like JUnit for Java, CppUnit for C++, PyUnit for Python. It also discusses test-driven development (TDD) and the benefits of unit testing such as improving code quality, facilitating refactoring and reducing regressions. MapReduce unit testing using Mockito and the dedicated MRUnit framework is also covered.
4Developers 2018: Evolution of C++ Class Design (Mariusz ?apiński)PROIDEA
?
Since the beginnings of C++, classes are the basic building block of any self-respecting application. The combination of data and its relevant functionality heavily impacts the way we modularize the program, design APIs, construct and reuse the code - think of software in general.
In the previous era, C++ was a hammer for every nail, providing secure high-level abstractions without sacrifice of the superior performance. Yet during the past decades, competing technologies dethroned it out of many domains. As the language evolved to prevail its principal advantages, so did the way classes are programmed.
I am pleased to invite you to a speech about code construction and programming techniques used in programs and libraries now and then. Expect a lot of code samples!
Fuzzing is a software testing technique that involves providing invalid, unexpected, or random data as inputs to a computer program to detect bugs. Coverage-guided fuzzing uses genetic algorithms to generate inputs that maximize code coverage. It is effective at finding security bugs like overflows, memory errors, and crashes. The presenter demonstrates finding 13 bugs in Boost regex in 30 minutes using libFuzzer. Fuzzing is widely used at Google to test critical software like browsers, libraries, and the Linux kernel due to its ability to find many bugs without requiring test cases.
Антон Наумович, Система автоматической крэш-аналитики своими средствамиSergey Platonov
?
В докладе будет рассмотрена система контроля качества с помощью снятия и анализа крэшдамп-файлов (применительно в первую очередь к системе Windows). Будет представлена архитектура и инструментарий для организации автоматического сбора и анализа крэшдамп-файлов, снимаемых в момент возникновения проблем в приложениях (падения, зависания, превышение потребления ресурсов – памяти, файловых дескрипторов и т.д.)
Антон Бикинеев, Writing good std::future< C++ >Sergey Platonov
?
В докладе Антон расскажет о грядущих мажорных изменениях языка, которые, не войдя в Стандарт 17-го года и оставшись в Technical Specifications, будут ждать своего мержа в 20-м, а также быть уже реализованными в некоторых компиляторах. Осветятся также минорные, уже одобренные фичи следующего Стандарта, как языковые, так и библиотечные. Антон расскажет об их целях, покажет методы использования, а также осветит некоторые гайдлайны и трики.
Despite all of the recent interest, concurrency in standard C++ is still barely in its infancy. This talk uses the primitives supplied by C++14 to build a simple, reference, implementation of a task system. The goal is to learn to write software that doesn’t wait.
Quality assurance of large c++ projectscorehard_by
?
This document discusses quality assurance techniques for large C++ projects. It describes the differences between quality assurance and quality control, with QA focusing on preventing defects during development, while QC finds defects in finished products. A variety of techniques are listed and their estimated effectiveness rates at finding defects. The document advocates using source control, build tools, coding standards, code reviews, unit testing, static analysis, code coverage, runtime verification tools, and continuous integration to improve quality assurance.
The document discusses clang-tidy, which is a tool for statically analyzing C++ code and finding typical programming errors. It has over 200 built-in rules for checking adherence to coding guidelines and best practices. The document provides examples of running clang-tidy on sample code and detecting issues. It also discusses how to develop custom rules by traversing the AST and registering matchers. Overall, the document serves as an introduction to using clang-tidy for code reviews and improving code quality.
SIMD machines — machines capable of evaluating the same instruction on several elements of data in parallel — are nowadays commonplace and diverse, be it in supercomputers, desktop computers or even mobile ones. Numerous tools and libraries can make use of that technology to speed up their computations, yet it could be argued that there is no library that provides a satisfying minimalistic, high-level and platform-agnostic interface for the C++ developer.
July 2015 Android Taipei - Anti-Decompiler by SUKISuki Huang
?
This document discusses various techniques for protecting Android apps from reverse engineering, including proguard, native development kit (NDK), encryption, and anti-decompilation. It notes that basic protections like changing package names, permissions, and debug modes are not sufficient. More advanced techniques like proguard to obfuscate code, NDK to use native code libraries, and encryption services can increase the difficulty of reversing but do not provide absolute protection. The overall goal is to raise the cost of reversing or cracking the app.
Here is a recursive C function that solves the Tower of Hanoi problem:
#include <stdio.h>
void towerOfHanoi(int n, char from_rod, char to_rod, char aux_rod)
{
if (n == 0)
return;
towerOfHanoi(n-1, from_rod, aux_rod, to_rod);
printf("Move disk %d from rod %c to rod %c\n", n, from_rod, to_rod);
towerOfHanoi(n-1, aux_rod, to_rod, from_rod);
}
int main()
{
int
One definition rule - что это такое, и как с этим житьPlatonov Sergey
?
В докладе будет разобрано, что-же такое ODR, какие ошибки могут быть из-за нарушения этого правила. Также будет представлен Proof-of-concept утилиты на базе clang tooling по автоматическому поиску таких ошибок.
PVS-Studio advertisement - static analysis of C/C++ codeAndrey Karpov
?
This document advertises the PVS-Studio static analyzer. It describes how using PVS-Studio reduces the number of errors in code of C/C++/C++11 projects and costs on code testing, debugging and maintenance. A lot of examples of errors are cited found by the analyzer in various Open-Source projects. The document describes PVS-Studio at the time of version 4.38 on October 12-th, 2011, and therefore does not describe the capabilities of the tool in the next versions. To learn about new capabilities, visit the product's site <a>http://www.viva64.com</a> or search for an updated version of this article.
The document discusses the Objective-C runtime and how it enables dynamic features of the Objective-C language. It covers how self is initialized by calling [super init], how messages are sent via objc_msgSend, and the basic structure of the Objective-C runtime including classes, objects, messaging and introspection. Examples of using the runtime API are provided, such as method swizzling and implementing a JSON model. The document provides references for further reading on the Objective-C runtime.
The document discusses different designs for asynchronous algorithms and reactive programming. It explores how to abstract sequences, control flow, cancellation, chaining of algorithms, and other aspects to support features like async generators, operators, testing, and failure handling. Push-based sequences, pull-based async generators, and Subject-Observer designs like SFRP are compared for supporting asynchronous and reactive programming.
Architecture for Massively Parallel HDL Simulations DVClub
?
This document describes Art of Silicon's architecture for massively parallel HDL simulations using Verilator. It allows running many simulations concurrently by generating a single testbench that can run on both Verilator and event-driven simulators. Identical C++ stimulus and checking code interfaces with the design through "gaskets". Logs are captured in a unified format across platforms for easy triage. This approach maximizes engineer productivity by minimizing idle simulation time.
Недавно работы комитета по стандартизации WG21 были завершены, и документ-черновик C++17 был отправлен на рассмотрение в Международную организацию по стандартизации (ISO). С этого момента технически можно считать, что стандарт C++17 у нас есть. Если вы ещё ознакомились с принятыми изменениями, то сейчас для этого самое время. В докладе будет сделан обзор нововведений. Рассмотрено текущее состояние дел у популярных компиляторов с поддержкой С++17
This document discusses an implementation of depth-first search (DFS) and breadth-first search (BFS) algorithms on a graph data structure. It includes Java code for Vertex, Graph, and Main classes that define a graph, add vertices and edges, and perform DFS and BFS searches. The Main class includes examples of constructing graphs and calling the search methods. Questions are provided at the end for testing DFS and BFS on additional graph examples.
Of complicacy of programming, or won't C# save us?PVS-Studio
?
Programming is hard. I hope no one would argue that. But the topic of new programming languages, or more exactly, search of a "silver bullet" is always highly popular with software developers. The most "trendy" topic currently is superiority of one programming language over the other. For instance, C# is "cooler" than C++. Although holy wars are not the reason why I'm writing this post, still it is a "sore subject" for me. Oh, come on, C#/lisp/F#/Haskell/... won't let you write a smart application that would interact with the outer world and that's all. All the elegance will disappear as soon as you decide to write some real soft and not a sample "in itself".
This document summarizes the analysis of the Qt 5.2.1 framework using the PVS-Studio static analysis tool. PVS-Studio detected 14 typos in Qt's code, including mistakes in variable names, missing comparisons, and identical subexpressions. It also found issues like loss of accuracy from integer division and an error related to operator priority. Overall, the author concludes Qt's code is high-quality but still contains ordinary typos that static analysis can help catch. Regular use of these tools could help prevent bugs early in development.
Virtual Functions support dynamic binding and object-oriented programming. A class that declares or inherits a virtual function is called a polymorphic class.
From Monolith to Modules - breaking apart a one size fits all product into mo...Robert Munteanu
?
This document summarizes a meetup on modularizing monolithic applications. It discusses benefits of modularization like slimmer, simpler code with reduced bugs and clear dependencies. Costs include complex API governance and fragmented deployments. Decoupling patterns for OSGi and content are presented, like glue bundles, optional dependencies, overlays, and feature extraction. Modularized testing is also discussed as a combinatorial nightmare to optimize.
This document summarizes Golang testing techniques including the built-in testing framework, mocks and fakes, monkey patching, helpers like Testify and Ginkgo, and dependency injection. It covers the basics of the built-in framework including table driven tests and code coverage. It discusses various mocking frameworks and issues with monkey patching. It also provides examples of using helpers and implementing dependency injection to make code more testable.
Gor Nishanov, C++ Coroutines – a negative overhead abstractionSergey Platonov
?
C++ coroutines are one of the few major features that may land in C++17. We will look at the current standardization status, available experimental implementations and develop a small coroutine adapter over raw C networking APIs that will beat hand-crafted state machine in performance.
The document describes how to implement a std::vector from scratch in C++. It begins with defining the vector interface and types like iterator, size_type, etc. It then describes implementing a vector_base class to handle memory allocation and storage. The rest of the document outlines methods for common vector operations without size modifications like at(), methods for changing the size like reserve(), insert(), and erase(). It provides code snippets and discusses using various Standard Library components to implement the vector functionality.
TensorFlow XLAの中では、
XLA Client を Pythonで利用できるようになっています。
また、2018年2月に開催されたSysMLの論文(JAX@Google)についても追記しました。
In TensorFlow XLA,
XLA Client is now available in Python.
Also added about SysML's paper (JAX @ Google) held in February 2018.
This document discusses a composable array function interface for heterogeneous computing in Java. It presents an API for array programming using functions like Map, Reduce, and Zip. These functions can be combined to express algorithms like dot product. The interface allows runtime code generation for CPUs and GPUs. An evaluation shows it achieves speedups over sequential Java for problems like Black-Scholes pricing by using multiple threads and GPU execution. Future work involves optimizing runtime scheduling and specialized code generation.
July 2015 Android Taipei - Anti-Decompiler by SUKISuki Huang
?
This document discusses various techniques for protecting Android apps from reverse engineering, including proguard, native development kit (NDK), encryption, and anti-decompilation. It notes that basic protections like changing package names, permissions, and debug modes are not sufficient. More advanced techniques like proguard to obfuscate code, NDK to use native code libraries, and encryption services can increase the difficulty of reversing but do not provide absolute protection. The overall goal is to raise the cost of reversing or cracking the app.
Here is a recursive C function that solves the Tower of Hanoi problem:
#include <stdio.h>
void towerOfHanoi(int n, char from_rod, char to_rod, char aux_rod)
{
if (n == 0)
return;
towerOfHanoi(n-1, from_rod, aux_rod, to_rod);
printf("Move disk %d from rod %c to rod %c\n", n, from_rod, to_rod);
towerOfHanoi(n-1, aux_rod, to_rod, from_rod);
}
int main()
{
int
One definition rule - что это такое, и как с этим житьPlatonov Sergey
?
В докладе будет разобрано, что-же такое ODR, какие ошибки могут быть из-за нарушения этого правила. Также будет представлен Proof-of-concept утилиты на базе clang tooling по автоматическому поиску таких ошибок.
PVS-Studio advertisement - static analysis of C/C++ codeAndrey Karpov
?
This document advertises the PVS-Studio static analyzer. It describes how using PVS-Studio reduces the number of errors in code of C/C++/C++11 projects and costs on code testing, debugging and maintenance. A lot of examples of errors are cited found by the analyzer in various Open-Source projects. The document describes PVS-Studio at the time of version 4.38 on October 12-th, 2011, and therefore does not describe the capabilities of the tool in the next versions. To learn about new capabilities, visit the product's site <a>http://www.viva64.com</a> or search for an updated version of this article.
The document discusses the Objective-C runtime and how it enables dynamic features of the Objective-C language. It covers how self is initialized by calling [super init], how messages are sent via objc_msgSend, and the basic structure of the Objective-C runtime including classes, objects, messaging and introspection. Examples of using the runtime API are provided, such as method swizzling and implementing a JSON model. The document provides references for further reading on the Objective-C runtime.
The document discusses different designs for asynchronous algorithms and reactive programming. It explores how to abstract sequences, control flow, cancellation, chaining of algorithms, and other aspects to support features like async generators, operators, testing, and failure handling. Push-based sequences, pull-based async generators, and Subject-Observer designs like SFRP are compared for supporting asynchronous and reactive programming.
Architecture for Massively Parallel HDL Simulations DVClub
?
This document describes Art of Silicon's architecture for massively parallel HDL simulations using Verilator. It allows running many simulations concurrently by generating a single testbench that can run on both Verilator and event-driven simulators. Identical C++ stimulus and checking code interfaces with the design through "gaskets". Logs are captured in a unified format across platforms for easy triage. This approach maximizes engineer productivity by minimizing idle simulation time.
Недавно работы комитета по стандартизации WG21 были завершены, и документ-черновик C++17 был отправлен на рассмотрение в Международную организацию по стандартизации (ISO). С этого момента технически можно считать, что стандарт C++17 у нас есть. Если вы ещё ознакомились с принятыми изменениями, то сейчас для этого самое время. В докладе будет сделан обзор нововведений. Рассмотрено текущее состояние дел у популярных компиляторов с поддержкой С++17
This document discusses an implementation of depth-first search (DFS) and breadth-first search (BFS) algorithms on a graph data structure. It includes Java code for Vertex, Graph, and Main classes that define a graph, add vertices and edges, and perform DFS and BFS searches. The Main class includes examples of constructing graphs and calling the search methods. Questions are provided at the end for testing DFS and BFS on additional graph examples.
Of complicacy of programming, or won't C# save us?PVS-Studio
?
Programming is hard. I hope no one would argue that. But the topic of new programming languages, or more exactly, search of a "silver bullet" is always highly popular with software developers. The most "trendy" topic currently is superiority of one programming language over the other. For instance, C# is "cooler" than C++. Although holy wars are not the reason why I'm writing this post, still it is a "sore subject" for me. Oh, come on, C#/lisp/F#/Haskell/... won't let you write a smart application that would interact with the outer world and that's all. All the elegance will disappear as soon as you decide to write some real soft and not a sample "in itself".
This document summarizes the analysis of the Qt 5.2.1 framework using the PVS-Studio static analysis tool. PVS-Studio detected 14 typos in Qt's code, including mistakes in variable names, missing comparisons, and identical subexpressions. It also found issues like loss of accuracy from integer division and an error related to operator priority. Overall, the author concludes Qt's code is high-quality but still contains ordinary typos that static analysis can help catch. Regular use of these tools could help prevent bugs early in development.
Virtual Functions support dynamic binding and object-oriented programming. A class that declares or inherits a virtual function is called a polymorphic class.
From Monolith to Modules - breaking apart a one size fits all product into mo...Robert Munteanu
?
This document summarizes a meetup on modularizing monolithic applications. It discusses benefits of modularization like slimmer, simpler code with reduced bugs and clear dependencies. Costs include complex API governance and fragmented deployments. Decoupling patterns for OSGi and content are presented, like glue bundles, optional dependencies, overlays, and feature extraction. Modularized testing is also discussed as a combinatorial nightmare to optimize.
This document summarizes Golang testing techniques including the built-in testing framework, mocks and fakes, monkey patching, helpers like Testify and Ginkgo, and dependency injection. It covers the basics of the built-in framework including table driven tests and code coverage. It discusses various mocking frameworks and issues with monkey patching. It also provides examples of using helpers and implementing dependency injection to make code more testable.
Gor Nishanov, C++ Coroutines – a negative overhead abstractionSergey Platonov
?
C++ coroutines are one of the few major features that may land in C++17. We will look at the current standardization status, available experimental implementations and develop a small coroutine adapter over raw C networking APIs that will beat hand-crafted state machine in performance.
The document describes how to implement a std::vector from scratch in C++. It begins with defining the vector interface and types like iterator, size_type, etc. It then describes implementing a vector_base class to handle memory allocation and storage. The rest of the document outlines methods for common vector operations without size modifications like at(), methods for changing the size like reserve(), insert(), and erase(). It provides code snippets and discusses using various Standard Library components to implement the vector functionality.
TensorFlow XLAの中では、
XLA Client を Pythonで利用できるようになっています。
また、2018年2月に開催されたSysMLの論文(JAX@Google)についても追記しました。
In TensorFlow XLA,
XLA Client is now available in Python.
Also added about SysML's paper (JAX @ Google) held in February 2018.
This document discusses a composable array function interface for heterogeneous computing in Java. It presents an API for array programming using functions like Map, Reduce, and Zip. These functions can be combined to express algorithms like dot product. The interface allows runtime code generation for CPUs and GPUs. An evaluation shows it achieves speedups over sequential Java for problems like Black-Scholes pricing by using multiple threads and GPU execution. Future work involves optimizing runtime scheduling and specialized code generation.
The document discusses strategies for effective communication during organizational change. It emphasizes that change causes disruption and emotional reactions, so communication must meet both informational and emotional needs. Key strategies include developing clear messages and using trusted leaders as messengers to build understanding of decisions. Frequent, two-way communication through multiple channels is important to address concerns throughout the change process. Confidentiality and coordinating communications precisely are also vital to change success.
Jonathan Gray gave an introduction to HBase at the NYC Hadoop Meetup. He began with an overview of HBase and why it was created to handle large datasets beyond what Hadoop could support alone. He then described what HBase is, as a distributed, column-oriented database management system. Gray explained how HBase works with its master and regionserver nodes and how it partitions data across tables and regions. He highlighted some key features of HBase and examples of companies using it in production. Gray concluded with what is planned for the future of HBase and contrasted it with relational database examples.
Study: The Future of VR, AR and Self-Driving CarsLinkedIn
?
We asked LinkedIn members worldwide about their levels of interest in the latest wave of technology: whether they’re using wearables, and whether they intend to buy self-driving cars and VR headsets as they become available. We asked them too about their attitudes to technology and to the growing role of Artificial Intelligence (AI) in the devices that they use. The answers were fascinating – and in many cases, surprising.
This 狠狠撸Share explores the full results of this study, including detailed market-by-market breakdowns of intention levels for each technology – and how attitudes change with age, location and seniority level. If you’re marketing a tech brand – or planning to use VR and wearables to reach a professional audience – then these are insights you won’t want to miss.
Artificial intelligence (AI) is everywhere, promising self-driving cars, medical breakthroughs, and new ways of working. But how do you separate hype from reality? How can your company apply AI to solve real business problems?
Here’s what AI learnings your business should keep in mind for 2017.
Story of static code analyzer developmentAndrey Karpov
?
The document discusses the history and development of static code analyzers. It describes how early tools used regular expressions that were ineffective for complex code analysis. Modern static analyzers overcome these limitations through techniques like type inference, data flow analysis, symbolic execution, and pattern-based analysis. They also leverage method annotations and a mixture of analysis approaches. While machine learning is hyped, static analysis remains very challenging due to the complexity of code and rapid language evolution.
This document introduces unit testing with PHPUnit. It discusses what unit testing is, why it's important, and tools like SimpleTest and PHPUnit. It provides examples of basic unit tests for a HelloWorld class using PHPUnit. It also covers more advanced testing techniques like data providers, expected exceptions, fixtures, doubles, mocks, stubs, and database testing using examples like testing a BankAccount class. The document provides hints and tips for unit testing MVC frameworks like Zend Framework.
Presentation showing that writing tests is not really hard with examples on testing a simple class, testing with dataproviders, fixtures, mocks, stubs, databases and how to use zend framework bootstrap for MVC testing.
Given at php|tek 09 unconf sessions.
Testes? Mas isso n?o aumenta o tempo de projecto? N?o quero...Comunidade NetPonto
?
Os Testes s?o cada vez mais uma necessidade nos projectos de desenvolvimento de software... Sejam eles unitários, de carga ou de "User Interface", uma boa framework de testes ajuda a resolver os problemas mais cedo, de forma mais eficaz e mais barata.
No final da sess?o vamos perceber n?o só para que servem, como s?o feitos e como o Visual Studio 2010 pode ajudar.
The document discusses implementing stored procedures in SQL. It covers creating stored procedures, executing them, passing parameters, modifying procedures, and returning values. Stored procedures offer benefits like improved performance, reduced network traffic, consistency and security. The document provides examples of creating different types of stored procedures, including generic procedures that accept variable input parameters.
This document describes the steps to convert a TensorFlow model to a TensorRT engine for inference. It includes steps to parse the model, optimize it, generate a runtime engine, serialize and deserialize the engine, as well as perform inference using the engine. It also provides code snippets for a PReLU plugin implementation in C++.
This document describes the steps to convert a TensorFlow model to a TensorRT engine for inference. It includes steps to parse the model, optimize it, generate a runtime engine, serialize and deserialize the engine, as well as perform inference using the engine. It also provides code snippets for a PReLU plugin implementation in C++.
The document discusses using test-driven development (TDD) with Python's unittest module for embedded C code, including an agenda covering what TDD is, why to use it, examples of using Python unittest with C and embedded C, and a case study of implementing TDD for a board support package (BOS) and dummy LED driver tests.
Moving from Jenkins 1 to 2 declarative pipeline adventuresFrits Van Der Holst
?
T-Dose 2017 presentation, Sunday 19 November 2017. Adventures building a declarative pipeline script for a traditional (non-java/non-cloud) installable windows/Linux application. Video will hopefully be available later.
Unit Testing Frameworks: A comparative studyIRJET Journal
?
This document provides a comparative study of various unit testing frameworks for different programming languages like C++, Java, and Python. It discusses the key features and differences between frameworks like Google Test and Google Mock, CppUnit, CppUTest for C++; JUnit and JMock, TestNG for Java; and Pytest and unittest for Python. The document finds that Google Test is more feature-rich for C++ compared to other frameworks. For Java, JUnit is considered best. And many Python projects are migrating from unittest to Pytest due to advantages like easier syntax and fixture reuse. The document concludes that choosing the right framework depends on the programming language and project requirements.
SoCal Code Camp 2015: An introduction to Java 8Chaitanya Ganoo
?
Java 8 introduced cool new features such as Lambdas and Streams. We'll take a look at what they are how to use them effectively. We'll also walkthrough an example of a lightweight Java 8 service running in AWS cloud, which can read and index tweets into an ElasticSearch cluster
Vladymyr Bahrii Understanding polymorphism in C++ 16.11.17LogeekNightUkraine
?
The document discusses polymorphism in C++, including static polymorphism through function overloading and templates, and dynamic polymorphism using virtual functions and inheritance. It explains key concepts like the virtual method table that allows dynamic dispatch at runtime. The document provides examples of polymorphism techniques like the curiously recurring template pattern and proper use of virtual destructors. It warns against invoking virtual functions from constructors due to the class hierarchy not being fully established yet.
The document discusses variadic templates in C++, including their fundamentals like parameter packs, common uses cases, and examples of how to work with parameter packs. It also covers variadic templates in more depth including expansion rules, where they are commonly used, and how to handle multiple expansions. The document concludes with an example of how variadic templates can be used to implement a typesafe printf function in C++.
Glow is a compiler and execution engine for neural networks created by Facebook. It takes a high-level graph representation of a neural network and compiles it into efficient machine code for different hardware backends like CPU and OpenCL. The key steps in Glow include loading a model, optimizing the graph, lowering it to a low-level IR, scheduling operations to minimize memory usage, generating instructions for the backend, and performing optimizations specific to the target. Glow aims to provide a portable way to deploy neural networks across different hardware platforms.
After reimplement many features several times in different platforms is time to think that it should be a better way. There are many frameworks that allows the developers to write the code once and deploy it "everywhere", but the final result is an app with a non native look and feel or with an emulated look and feel that the users can see and rate according to the quality.
There are other ways to develop apps for multiple platforms without rewriting the same code over and over. I'll talk about one of that ways which consists on developing the core with C++ and implement the UI natively. This method could sound very scary because of the C++ reputation (memory leaks, the standard library, etc), but with C++11 all this has been improved in a very sweet way, so maybe it is time to take an other look at this language and see how can we take advantage of it.
27. Map-Reduce单元测试public class TestMockito { @Test public void processValidRecord() throws IOException {WordCount.Mapmapper = new WordCount.Map();OutputCollector<Text, IntWritable> output = mock(OutputCollector.class); Text value = new Text("hello hello"); mapper.map(null, value, output, null); verify(output, times(2)).collect(new Text("hello"), new IntWritable(1)); }}2010-9-15TaobaoSearch27