Answered step by step
Verified Expert Solution
Question
1 Approved Answer
These questions are regarding Unit Tests: For each of the following scenarios, identify the type of double which would be most useful. You would like
These questions are regarding Unit Tests:
For each of the following scenarios, identify the type of double which would be most useful. You would like to create a special version of a class except that does not access certain expensive operations. You would like to monitor how a given variable or collections of variables are used in a given class. You would like to guarantee that a given class is never used in a certain method under test. There are three states required for a given test case. We want to make sure that these states and no others are utilized in the unit test. The class we commonly used to build other doubles from. You would like a special version of a class that only represents a single state - the state needed for a specific test case. Imagine a class representing a GPA. Identify the type of double from the example below: Double Stub Fake Dummy Mock Spy Imagine a class representing a GPA. Identify the type of double from the example below: class TestGPA : public GPA \{ private: int state; public: TestGPA() : state(0) \{\} double get () const { assert ( state ==1); state =2; return gpa; void set (double gpa) \{ assert(state==0);state=1;this->pa=gpa; \}; Dummy Fake Mock Stub Double SpyStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started