Tests and code for union