improved NewResource.is_valid().
added test for is_valid.