The European Court of Justice (ECJ) has rejected a challenge brought by Hungary and Slovakia against the European Union's power to force member states to admit asylum seekers.