Add unittest, relatively whitebox.