using assertArrayEquals and added check for null to merge method