First thing is to add an Inspector after the Tester transformer to see why it fails.
My guess is that one of the attributes will be converted to a numeric value (201 instead of 0201).
I assume you used index 0 to 3 in the SubstringExtractor (that will be the first 4 characters).
Besides that this should work and you are on the right track.
To merge the country name on the communes you will need the FeatureMerger transformer (communes as Requestor, country as Supplier).
You will only want to use the SubstringExtractor on the shapefile containing the communes. From there, you can use a FeatureMerger feeding the communes into the Requestor port, and country into the Supplier port. You will need to specify the attributes that contain the common TERYT number. The features from the merged port will be communes, with attributes of the matching country.
One of the reasons you could be failing at the Tester is if the two attributes you are comparing there don't match.
EX- _substring (1) vs jpt_kod_je(1) might not match but _substring(2) and jpt_kod_je(1) do.
The Tester won't look at the TERYT attributes as a list to see if the one you're comparing against is in there. You could create a list of the different country values (ListBuilder), and compare against the communes values that way. The FeatureMerger like @cartoscro and @erik_jan is also the way to go.
The Transformer FeatureMerger helps! Thank you so much!
First thing is to add an Inspector after the Tester transformer to see why it fails.
My guess is that one of the attributes will be converted to a numeric value (201 instead of 0201).
I assume you used index 0 to 3 in the SubstringExtractor (that will be the first 4 characters).
Besides that this should work and you are on the right track.
To merge the country name on the communes you will need the FeatureMerger transformer (communes as Requestor, country as Supplier).
Two attributes is text type - all has 0 in front of them.