Skip to content

Improve dependencies management#159

Merged
yuri-sergiichuk merged 41 commits intomasterfrom
improve-deps-management
Dec 8, 2020
Merged

Improve dependencies management#159
yuri-sergiichuk merged 41 commits intomasterfrom
improve-deps-management

Conversation

@yuri-sergiichuk
Copy link
Contributor

This PR improves our Gradle dependencies management a bit and applies the new scope to the dependencies that are used by the code analysis software only.

As part of the PR, I have also eliminated the usage of the hamcrest assertion framework in favor of truth. mockito usage is replaced with hand-crafted mocks.

The change is related to the SpineEventEngine/config#156 issue.

@yuri-sergiichuk yuri-sergiichuk self-assigned this Dec 7, 2020
@codecov
Copy link

codecov bot commented Dec 7, 2020

Codecov Report

Merging #159 (7d30d92) into master (39d7a48) will decrease coverage by 1.93%.
The diff coverage is 32.40%.

@@             Coverage Diff              @@
##             master     #159      +/-   ##
============================================
- Coverage     61.98%   60.04%   -1.94%     
- Complexity      178      210      +32     
============================================
  Files            88       93       +5     
  Lines          2191     2370     +179     
  Branches         40       43       +3     
============================================
+ Hits           1358     1423      +65     
- Misses          824      936     +112     
- Partials          9       11       +2     

@yuri-sergiichuk yuri-sergiichuk requested a review from a team December 7, 2020 13:35
@yuri-sergiichuk yuri-sergiichuk marked this pull request as ready for review December 7, 2020 13:36
Copy link
Contributor

@armiol armiol left a comment

Choose a reason for hiding this comment

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

@yuri-sergiichuk please see my comments.

* <p>Supports having a custom write latency through {@linkplain #withSimulatedLatency(Duration)
* setting} a particular write operations duration.
*/
public final class MemoizedFirebase implements FirebaseClient {
Copy link
Contributor

Choose a reason for hiding this comment

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

This should probably be MemoizingFirebase.

* Returns a {@code NodeValue} written to a specific {@code path}.
*
* @throws IllegalStateException
* if no value is present for the path.
Copy link
Contributor

Choose a reason for hiding this comment

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

It looks unformatted to me.

Also, we don't put periods in descriptions of parameters and exceptions.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's how the @throws block is formatted.

* <p>The node has a single randomized field with the field value being a serialized
* processed message.
*
* @implNote the {@code nodeValue} holds data as a JSON primitive string (i.e. an
Copy link
Contributor

Choose a reason for hiding this comment

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

Please start this the with the capital letter.

* Creates an {@code HttpClient} mock which returns the specified {@code content}
* on every request and uses supplied {@code observer} while building requests.
*/
static HttpClient mockHttpClient(String content, RequestObserver observer) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't understand neither the naming nor the purpose of RequestObserver. Could you please elaborate on this so that this API piece looked a bit more clear to a naked eye?

/**
* Observes built HTTP requests.
*/
interface RequestObserver {
Copy link
Contributor

Choose a reason for hiding this comment

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

This name confuses me as well as the API which uses it.

If I'd wake somebody up at 3 AM and ask what a RequestObserver does, they would hardly answer correctly.

import static java.util.Collections.emptyIterator;

/**
* A mocked servlet request with pre-defined {@code content}, {@code type} and {@code headers}.
Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't any servlet request a "fixed content" request? I mean, each of servlet requests does have a content, type and headers which never-ever are changed.

It's either about a description that I understand incorrectly, or about the name for this type which is confusing if compared to a description.

*
* <p>In most cases this implementation should be sufficient enough for local tests.
*/
public final class FixedContentResponse implements MockedResponse {
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as above.

Can't we just simplify the whole naming paradigm to KnownRequest / KnownResponse or GivenRequest / GivenResponse, or something?

/**
* A mocked response whose {@code status} and {@code type} could be set.
*/
public final class SettableResponse implements MockedResponse {
Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't it MutableResponse?

I also don't really understand why we divide the mock types into fixed first and second and fixed third. Isn't it simpler to have just one mock type?

@yuri-sergiichuk
Copy link
Contributor Author

@armiol PTAL again.

@yuri-sergiichuk yuri-sergiichuk merged commit 721a85d into master Dec 8, 2020
@yuri-sergiichuk yuri-sergiichuk deleted the improve-deps-management branch December 8, 2020 16:11
@yuri-sergiichuk yuri-sergiichuk mentioned this pull request Dec 15, 2020
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.

2 participants