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

Tests added, critical Sonar complains resolved #59

Merged

Conversation

eupakhomov
Copy link
Contributor

BaseWssFactoryBuilder and BaseWssSocketBUilder updated to be more flexible and testable
Tests added for wss/* classes

BaseWssFactoryBuilder and BaseWssSocketBUilder updated to be more flexible and testable
Tests added for wss/* classes
@coveralls
Copy link

coveralls commented Apr 25, 2018

Coverage Status

Coverage increased (+1.8%) to 55.603% when pulling 84f123f on eupakhomov:0.5_sonar_complains_fixed_tests_added into 48d0dfd on ChargeTimeEU:master.

@codecov-io
Copy link

codecov-io commented Apr 25, 2018

Codecov Report

Merging #59 into master will increase coverage by 1.66%.
The diff coverage is 62.96%.

@@             Coverage Diff              @@
##             master      #59      +/-   ##
============================================
+ Coverage     51.04%   52.71%   +1.66%     
- Complexity      759      785      +26     
============================================
  Files           180      180              
  Lines          3048     3060      +12     
  Branches        218      221       +3     
============================================
+ Hits           1556     1613      +57     
+ Misses         1407     1360      -47     
- Partials         85       87       +2

Copy link
Member

@TVolden TVolden left a comment

Choose a reason for hiding this comment

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

The test names could use some work. I like to name them after the following format: unitUnderTest(method)_setup_expectedBehaviour.

This name convention is easier if you reduce the amount of asserts (preferably one), which in turn makes it easier to quickly identify what exactly is broke.

@@ -154,7 +154,10 @@ protected Message parse(Object json) {
((CallErrorMessage) message).setErrorCode(array.get(INDEX_CALLERROR_ERRORCODE).getAsString());
((CallErrorMessage) message).setErrorDescription(array.get(INDEX_CALLERROR_DESCRIPTION).getAsString());
((CallErrorMessage) message).setRawPayload(array.get(INDEX_CALLERROR_PAYLOAD).toString());
} else {
throw new IllegalArgumentException("Unknown message type");
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd like to suggest you to add JSON body to the log.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

if(sslSocketFactory == null) {
throw new IllegalStateException("sslSocketFactory must be set");
}

if(complete) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Put space before '(', please. There and in other places.

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 would propose to define reference for the project for a particular codestyle so it could be formatted automatically in accrodance (e.g. https://google.github.io/styleguide/javaguide.html)

Socket expectedSocket = mock(Socket.class);
Socket socket = mock(Socket.class);
when(socket.isBound()).thenReturn(false);
when(sslSocketFactory.createSocket(socket,"fake", 101, false)).thenReturn(expectedSocket);
Copy link
Contributor

Choose a reason for hiding this comment

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

Please, put space after comma. There and in other places.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done for the particular case. In general I would propose to define reference for the project for a particular codestyle so it could be formatted automatically in accrodance (e.g. https://google.github.io/styleguide/javaguide.html)

@TVolden
Copy link
Member

TVolden commented Apr 29, 2018

What do you think @eupakhomov ?

Logging of message body added to JSON communicator in case of unknown message type
Cosmetics
@eupakhomov
Copy link
Contributor Author

Sorry for the delay. Tests' names are fixed in wss package (each test uses exactly one assertion sometimes with a few verifications as well). For code style I would propose to define a common approach.

Copy link
Member

@TVolden TVolden left a comment

Choose a reason for hiding this comment

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

Those last two test classes are pretty complex, I have to set off some time to read it through.

@TVolden TVolden merged commit b93a138 into ChargeTimeEU:master May 25, 2018
@eupakhomov eupakhomov deleted the 0.5_sonar_complains_fixed_tests_added branch June 27, 2018 11:28
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