# Week 20
## Recap
This week is definitely a shorter week in terms of actual update content. My work was mainly focused on the continued designing of tests for the content related packets of the History Network, in addition to learning the necessary library to handle mock database interactions. I was able to catch an error fairly quickly dealing with the CONTENT packet getContentType() parsing in the findContent() method of the History Network. Otherwise everything seemed to go pretty smoothly with the main challenge just being to find different edge cases that I am then able to test. This work will continue into the following week as I look to wrap up this part of testing and work on my final project report.
## Learning
Not too much to mention in regards to learning besides continued reference to the Portal Wire Specifications. I did learn about Mockito to create more comprehensive tests as well as to deal the with database abstraction question that I had ran into last week.
### Concepts
#### Portal Wire Specifications
Again, using test vector values proved useful in generating actual values for then testing outbound communication. As well as looking through the specifications to come up with any special cases that may need to be tested.
##### Resources
1. https://github.com/ethereum/portal-network-specs/blob/master/portal-wire-protocol.md
2. https://github.com/ethereum/portal-network-specs/blob/master/portal-wire-test-vectors.md
#### Mockito
It took me a bit to get used to the Mockito library and to understand its usage in testing. Once I was able to understand the conceptual need for it I could then start learning about the different methods it provides. The most important of which involved the use of the when() and thenReturn() methods for mocking database interaction.
##### Resources
1. https://site.mockito.org/
## Tasks
All of my work revolved solely around implementing tests for the History Network content related communication. Mainly just the outbound communication regarding the FINDCONTENT packet. I started with the focus of testing each of the three CONTENT packet subtypes for three situations: A good response, empty response and bad response. I quickly was able to uncover and fix an error regarding my use of a switch case, which was resolved by converting it to a rule switch as opposed to the traditional design. Otherwise it was pretty steady going once I had learned how to properly use Mockito for emulating database responses and interaction.
## Week 21 Plan
Heading into Week 21 I am looking to just finish up on my current work creating tests and not really create anything new. Mainly for the sake of then working on and documenting everything up to this point for the final project report. In general though, the actual implementation tasks that I want to complete are:
- Finish up on the outbound testing for the History Networks FINDCONTENT packet
- Potentially do the inbound testing depending on how long the previous point takes
- Work with Meldsun to get the client ready for linking with the Portal Hive tests
Then of course also work on my final project presentation. My goal to have completed by the time I present is hopefully the client linked to the Portal Hive tests just to provide a proof of client functionality outside of using and observing the parts implemented in Samba itself.