Skip to content

Add Tests#22

Open
lbkehlmann wants to merge 17 commits intodevelopfrom
authenticateTest
Open

Add Tests#22
lbkehlmann wants to merge 17 commits intodevelopfrom
authenticateTest

Conversation

@lbkehlmann
Copy link

Adds tests. Increases test coverage from 30% to 70% 😸 See https://coveralls.io/r/toopher/toopher-java

lbkehlmann and others added 16 commits June 4, 2014 11:12
It was difficult to test ToopherAPI because ToopherAPI#authenticate
instantiated AuthenticationStatus objects. It's now possible to provide
an AuthenticationStatusFactory to ToopherAPI.

To facilitate optional arguments to ToopherAPI, there's now a ToopherAPI
builder that all of the existing constructors dump their arguments into,
and a ToopherAPI constructor which takes a ToopherAPI.Builder.

There's a mock factory and an example test (that should be renamed or
removed) that demonstrates the use of these new classes.
* feature/builders:
  Add factories and builders all over the places

Conflicts:
	src/test/java/com/toopher/TestToopherAPI.java
Copy link
Member

Choose a reason for hiding this comment

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

Why not check for null and not empty for this and the following property?

Copy link

Choose a reason for hiding this comment

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

This is code from ToopherAPI that I refactored to use builders and factories. There wasn't a null check in the original code and I didn't want to add a null check for fear of changing the behavior, since we didn't have tests around it.

@coveralls
Copy link

Coverage Status

Coverage increased (+24.32%) when pulling e4b2f65 on authenticateTest into 2c1b483 on develop.

Copy link
Member

Choose a reason for hiding this comment

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

What would the json parameter contain in this case? Without reviewing the code more thoroughly this method seems like it would simply create an object from json then set the same properties again.

Copy link

Choose a reason for hiding this comment

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

json is the JSONObject, like AuthenticationStatus#_raw_data (or whatever) in toopher-python. Off the top of my head, the only thing that the call to super does is save json as an instance variable.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants