Skip to content

Commit

Permalink
Update Report5.md
Browse files Browse the repository at this point in the history
  • Loading branch information
bingbing575757 authored Mar 6, 2024
1 parent ff73f30 commit d923d3d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Report5.md
Original file line number Diff line number Diff line change
Expand Up @@ -196,9 +196,9 @@ As for testing, we need to initializz and Configure the Mock Environment first.
```
`MockedStatic<UUID>`: We uses Mockito to create a mock environment for the static method `randomUUID()` of the UUID class. This means that within this mock environment, the behavior of `UUID.randomUUID()` will no longer be generating a new, random UUID, but will execute according to the logic we specify.

`UUID fakeUuid = new UUID(0L, 0L);`: Creates a UUID. This UUID, being a fixed value, is used to verify whether the serialization logic correctly processes this specific UUID.
`UUID specificUuid = UUID.fromString("123e4567-e89b-12d3-a456-426614174000");`: Creates a UUID. This UUID, being a fixed value, is used to verify whether the serialization logic correctly processes this specific UUID.

`mockedUuid.when(UUID::randomUUID).thenReturn(fakeUuid);`: This line specifies that when `UUID.randomUUID()` is called, it should return your fixed UUID specificUuid instead of a genuinely random UUID. This allows you to control the behavior and output of the test.
`mockedUuid.when(UUID::randomUUID).thenReturn(specificUuid);`: This line specifies that when `UUID.randomUUID()` is called, it should return your fixed UUID specificUuid instead of a genuinely random UUID. This allows you to control the behavior and output of the test.

Then we initializes an instance of `UuidBinarySerde` and configures it by calling the `configure` method. As for `serde.serializer("anyTopic", Serde.Target.VALUE);` it retrieves an instance of the Serializer for value (VALUE) serialization.

Expand Down Expand Up @@ -245,4 +245,4 @@ At last, we uses `Mockito` to verify whether `UUID.randomUUID()` was called at l
[5] "Software Testing - Mock Testing". (2022, July 22). GeeksforGeeks. Retrieved March 4, 2024, from https://www.geeksforgeeks.org/software-testing-mock-testing/
[6]*Mock object*. (2024, February 29). Wikipedia, the free encyclopedia. Retrieved March 3, 2024, from https://en.wikipedia.org/wiki/Mock_object
[6]*Mock object*. (2024, February 29). Wikipedia, the free encyclopedia. Retrieved March 3, 2024, from https://en.wikipedia.org/wiki/Mock_object

0 comments on commit d923d3d

Please sign in to comment.