German investor optimism worsened far more than expected as the war in Iran tempers hopes that Europe’s largest economy is on the cusp of a strong revival.