Port over code from jbuilder test.