Triggers can't have annotations, and while they can contain classes, those classes can't be "special" classes, such as @RestResource classes. You need to make a class to test the trigger. Do not confuse a class with a trigger. A trigger looks like a class, but has different semantics.
The following code won't compile:
@isTest trigger MyTrigger on Case (after insert) { ...
Nor will this:
trigger MyTrigger on Case (after insert) {
@isTest class TestTrigger { ...
Instead, make your trigger:
trigger X on Y (...) { ...
And a class for that trigger:
@isTest class TestTriggerX {
@isTest static void testTrigger() { ...
Classes are made in Setup > Develop > Apex Classes, while triggers are made on the object (e.g. Setup > Customize > Accounts > Triggers). The word "class" generally should never appear in your triggers, and the word "trigger" should generally never appear in your classes.
You can't combine multiple top-level elements into a single class or trigger.