CAPTURE: Context-Aware Prompt Injection Testing and Robustness Enhancement