-
Notifications
You must be signed in to change notification settings - Fork 0
Move SmallCityServiceTest and create BusinessesServiceTest #96
base: master
Are you sure you want to change the base?
Conversation
| private final MapLocation TEST_MAP_LOCATION = new MapLocation(39.459836, -76.742536); | ||
| private final String TEST_PRODUCT = "pizza"; | ||
|
|
||
| private final List<Listing> TEST_PASSED_LIST = new LinkedList<>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
List of what exactly? Businesses? BigBusinesses? SmallBusiness?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed the name to TEST_ALL_BUSINESSES which is the name of the parameter passed into the businesses service constructor - does that make more sense?
| private final int MIN_LISTINGS_RETURNED = 20; | ||
| private final int MAX_LISTINGS_RETURNED = 60; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/RETURNED/ALLOWED
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
| Assert.assertTrue(actual.size() >= MIN_LISTINGS_RETURNED); | ||
| Assert.assertTrue(actual.size() <= MAX_LISTINGS_RETURNED); | ||
|
|
||
| int containsCounter = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure I follow this naming pattern.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed the name of this variable - let me know if it makes more sense now
ethanimooney
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just gotta get one last LGTM in :)
For real though, these look good!
Summary: Create tests to test places API aspects of Businesses service class
SmallCityServiceTest.java: Moved the tests that were in the former BigBusinessesTest.java file to a new SmallCityServicesTest.java file
BusinessesServiceTest.java: Using the Mockito framework, I created tests for the getBusinessesByTextSearch() and getBusinessesByNearbySearch() functions. I created a mock list of businesses known to be returned by the places API given the test map location. The test checks to see if the list returned by the actual functions are the correct length (between 20 and 60 businesses) and contain all 3 of the expected businesses as returned from the mock.
There is definitely more to be done here, but it depends if time allows for it! I just wanted to get this our sooner rather than later!