Skip to content

Conversation

@flylight
Copy link
Collaborator

@flylight flylight commented Jul 4, 2017

  • Refactored Hackster service
  • Registered Config Server in Discovery Server

NOTICE : As Config Server gets configuration from master branch then current branch is can't build. Please, review then merge and only then try to play with it.

  • Left to do : Need to resolve Configuration Server via Discovery Server

@flylight flylight requested review from banadiga and tsypuk July 4, 2017 21:35
Copy link
Member

@banadiga banadiga left a comment

Choose a reason for hiding this comment

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

...
[INFO] Hackster service ................................... FAILURE [  6.763 s]
[INFO] Storage service .................................... SKIPPED
[INFO] Storage service client ............................. SKIPPED
[INFO] Realtor service .................................... SKIPPED
[INFO] API gateway service ................................ SKIPPED
[INFO] spring-cloud ....................................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE


@PostConstruct
public void test () {
System.out.println(rate);
Copy link
Member

Choose a reason for hiding this comment

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

👎

public void checkIfOldNumberIsNotHackster() {
boolean isHacksterFalse = hacksterServiceClient.isHackster("321321312");

for (int i = 0; i < 5; i++) {
Copy link
Contributor

Choose a reason for hiding this comment

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

What for is doing in test ?

Copy link
Contributor

Choose a reason for hiding this comment

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

Better use repository to persist Hackster with desired numberOfApartments first.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This test tests exact situation when phone number become a hackster. No reason to prepare such data set, then no value from such test.


boolean isHacksterTrue = hacksterServiceClient.isHackster("321321312");

assertThat(isHacksterFalse, equalTo(false));
Copy link
Contributor

Choose a reason for hiding this comment

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

why 2 assertions ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Because it's clarify that number which wasn't hackster on beginning become a hackster after several calls

Copy link
Member

Choose a reason for hiding this comment

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

perform assert as soon as you can

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah, will remove first assertion as you were right and this behavior already covered.

private MockMvc mockMvc;

@Test
public void checkIfNewPhoneNumberIsNotHakster() throws Exception {
Copy link
Contributor

Choose a reason for hiding this comment

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

I do not like naming
Use convention _

ex:
public void isHackster_newPhone() {}

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Not agree with Snake_Case, if you don't like this name we can discuss it, but change Java convention to something else doesn't make sense

}

@Test
public void checkIfOldPhoneNumberIsNotHakster() throws Exception {
Copy link
Contributor

Choose a reason for hiding this comment

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

naming

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Will rename, but not use snake_case

.andExpect(status().isOk())
.andExpect(content().string("false"));

for (int i = 0; i < maxAllowedApartmentsPerRealtor - 1; i++) {
Copy link
Contributor

Choose a reason for hiding this comment

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

What are you testing here ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

That phone which was not a hakster will become a hackster after configured number of calls


@Test
public void checkIfOldPhoneNumberIsNotHakster() throws Exception {
mockMvc.perform(get("/hackster/321321"))
Copy link
Contributor

Choose a reason for hiding this comment

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

It is the same test with loop ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

No, this is totally different cases using same functionality.

mockMvc.perform(get("/hackster/321321"));
}

@Test
Copy link
Member

Choose a reason for hiding this comment

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

please leave contextLoads in HacksterServiceApplicationTests and move other test to HacksterServiceIntegrationTests

<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<spring-cloud.version>Dalston.SR1</spring-cloud.version>
Copy link
Member

Choose a reason for hiding this comment

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

use <spring-cloud.version>Dalston.RELEASE</spring-cloud.version>

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Nice catch


boolean isHacksterTrue = hacksterServiceClient.isHackster("321321312");

assertThat(isHacksterFalse, equalTo(false));
Copy link
Member

Choose a reason for hiding this comment

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

perform assert as soon as you can

@banadiga banadiga merged commit 85a5a6e into master Jul 11, 2017
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.

3 participants