Cricket: Black Caps win to snap test losing streak