Mocking a http post server with node.js

Sometimes we need to contact remote servers and send him some data. It is hard to test the whole feature if the remote server does not offer you a sandbox environment. An easy way to do it is creating a mock http server and for me, the easiest way of doing it is with node.js Install node.js Node.js offers a great page for downloading it, I prefer to use it the package manager options....

January 6, 2021 · 2 min · Tomás Dias Almeida

Mocking static methods (and constructors) using Mockito 3.5.0+

Since version 3.4.0, Mockito allows us to mock static methods, so you do not need to add powermock as dependency for most of your necessities. I will not discuss why we should avoid static methods or helper class with static methods, as several articles do it quite well (1, 2, 3, etc..), we need to deal with static methods in the real world of development and mockito helps us to create unit tests when these static methods are involved....

December 30, 2020 · 4 min · Tomás Dias Almeida

Showing hidden files and folder on Finder (MacOS)

One thing that I miss from Windows is the Windows Explorer (yes, I like it). Finder is not as good as Windows Explorer… Permanent solution I like to see all my files, so to do it on MacOS , open a terminal and type defaults write com.apple.Finder AppleShowAllFiles true killall Finder Revert changes This setting is persisted even after a restart, so if you want to go back to your previous status (hidden files are hidden), open a terminal again and type:...

December 26, 2020 · 1 min · Tomás Dias Almeida

Creating a blog using Hugo, travis-ci and Github pages

How I created this blog As many github blogs born and die, my first post is how I created this blog using hugo as static page generator, travis-ci as CI/CD and github pages as page hosting. As I do not want to have 2 separate repositories as proposed by Claudio Jolowicz in his tutorial, I will use the possibility to host the source under main and the page itself under another branch....

December 24, 2020 · 6 min · Tomás Dias Almeida