Test Object Adapter Source

Functions

TEST_F(AdapterPatternTest, AdapteeFunctionality)

Test:

Validates that the Adaptee’s specificRequest() method works as expected.

This test ensures the Adaptee can perform its functionality independently without requiring adaptation.

TEST_F(AdapterPatternTest, AdapterFunctionality)

Test:

Validates that the Adapter translates the Target’s request() call correctly.

This test ensures the Adapter acts as an intermediary between the client (using Target) and the Adaptee, translating the request method.

TEST_F(AdapterPatternTest, AdapterImplementsTarget)

Test:

Verifies the Adapter implements the Target interface.

This test ensures polymorphism by confirming that the Adapter can be used in place of any Target implementation.

class AdapterPatternTest : public testing::Test

Fixture for testing the Adapter Pattern implementation.

The fixture sets up shared objects and utilities for testing the interaction between Target, Adaptee, and Adapter classes.

Protected Functions

inline void SetUp() override

Sets up the test environment.

This method creates an Adapter instance wrapping the Adaptee object.

inline void TearDown() override

Cleans up the test environment.

This method deletes the Adapter instance to free allocated resources.

Protected Attributes

Adaptee adaptee

Instance of Adaptee for testing.

Adapter *adapter = nullptr

Pointer to the Adapter being tested.

Inner Classes