Skip to content
This repository was archived by the owner on Jun 1, 2023. It is now read-only.

Conversation

@LindseyWeiskopf
Copy link
Contributor

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!

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<>();

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?

Copy link
Contributor Author

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?

Comment on lines 16 to 17
private final int MIN_LISTINGS_RETURNED = 20;
private final int MAX_LISTINGS_RETURNED = 60;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/RETURNED/ALLOWED

Copy link
Contributor Author

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;

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.

Copy link
Contributor Author

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

@LindseyWeiskopf LindseyWeiskopf linked an issue Aug 7, 2020 that may be closed by this pull request
Copy link
Contributor

@ethanimooney ethanimooney left a 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!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add testing for Places API

3 participants