OneBusAway / onebusaway-alexa

An Java-based app to communicate with Amazon Alexa for devices such as the Amazon Echo
Other
52 stars 18 forks source link

Use JMockit; add unit tests #20

Closed philipmw closed 8 years ago

philipmw commented 8 years ago

Addresses issue #18. I switched from Mockito to JMockit. This allows us to mock OBA libraries, so I wrote some new unit tests also.

barbeau commented 8 years ago

Cool! Looks like this failed on Travis though:

<<< FAILURE! - in org.onebusaway.alexa.MainSpeechletEmptyTest
setRecognizableCity(org.onebusaway.alexa.MainSpeechletEmptyTest)  Time elapsed: 0.013 sec  <<< FAILURE!
java.lang.AssertionError: 
Expected: a string starting with "Ok, you live in Seattle.  What's your stop number?"
     but: was "OneBusAway could not locate a OneBusAway installation in Seattle, the city you gave. Tell me again, in what city do you live?"
    at org.onebusaway.alexa.MainSpeechletEmptyTest.setRecognizableCity(MainSpeechletEmptyTest.java:115)
philipmw commented 8 years ago

Huh. It Works On My Desktop®. I'll look into it.

barbeau commented 8 years ago

Yeah, this fails on my local machine as well, same error.

philipmw commented 8 years ago

Ok. I will look into it in the next couple of days. I am beaching in sunny LA right now, down from gloomy drizzly Seattle.

barbeau commented 8 years ago

Sure, no rush. Enjoy the sun :).

philipmw commented 8 years ago

I reproduced this problem. I guess it fails on my computer also. I am investigating.

philipmw commented 8 years ago

BAM. Passes. With this PR, I am satisfied with the initial state of our tests. These tests set a good example for how to test any part of the current system, including mocking OBA classes.

barbeau commented 8 years ago

Awesome, thanks @philipmw! LGTM. Great to have a set of solid unit tests.