Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Completely missing unit tests #7

Closed
ewoks opened this issue Apr 10, 2017 · 2 comments
Closed

Completely missing unit tests #7

ewoks opened this issue Apr 10, 2017 · 2 comments
Assignees

Comments

@ewoks
Copy link

ewoks commented Apr 10, 2017

Unit tests would contribute a lot to overall quality of project

@aurasphere
Copy link
Owner

Hi ewoks! Thank you for your contribution! I agree with you, unit tests will improve overall quality. The problem is that the app is strongly dependent on other devices since it's about bluetooth pairing. If you have any suggestions for tests to implement or you want to add them yourself, feel free to suggest/help. Thank you again!

@vrnsky
Copy link
Contributor

vrnsky commented Apr 17, 2017

@aurasphere Hi, I am new for your project I see code and my suggestion is used mockito and powermockito with junit to testing. Mockito provide mocking function and power mockito allow check that some method called in class. For example:

Context context = mock(Context.class);
BluetoothDiscoveryDeviceListener listener = mock(BluetoothDiscoveryDeviceListener.class);

BluetoothController controller = new BluetoothController(context, listener);

when(controller.isBluetoothEnabled()).thenReturn(false);
assertThat(controller.isBluetoothEnabled(), is(false));

aurasphere added a commit that referenced this issue Apr 22, 2017
Add a simple unit test (issue #7)
@aurasphere aurasphere self-assigned this Sep 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants