Fixed issue with old-style metadata on examples

The metadata would not be applied, because it would be replaced with new-style
meta-data
Reduced test code duplication