If you have AppleCare+ it will cover a large portion of accidental damage.
https://www.apple.com/support/products/mac.html
In or out of warranty you can get a free over the counter 'Apple Service Diagnostics' test
Genius reservation http://www.apple.com/retail/geniusbar/
on-line https://getsupport.apple.com/
check warranty https://checkcoverage.apple.com/
Similar to AppleCare+ for iPhone and iPad, each incident of accidental damage for Mac will carry its own price tag. Screen damage or “external enclosure damage” will run $99 per incident, while other damage, including water damage, will run $299. Users receive coverage of two incidents under AppleCare+, and after the two incidents have been used up, out-of-warratny replacement rates will apply