trebol-ecommerce / trebol-backend-monolith

Monolithic eCommerce backend web application that exposes a RESTful API.
MIT License
16 stars 21 forks source link

improved the if statement #196

Closed shivam-Purohit closed 1 year ago

shivam-Purohit commented 1 year ago

PR Checklist

PR Type

Summary

Improved the if statement to make the code shorter and easy to understand

shivam-Purohit commented 1 year ago

should I need to add the dependencies. I added `

org.apache.commons
  <artifactId>commons-lang3</artifactId>
  <version>3.12.0</version>
</dependency>

in pom.xml and this is my if statement code if (!StringUtils.isEmpty(phone1) && !StringUtils.equals(target.getphone1(),phone1)) { target.setPhone1(phone1); }` is this Okay?

NyorJa commented 1 year ago

!StringUtils.equals(target.getphone1(),phone1) is ok. It has null checking on it.

image

shivam-Purohit commented 1 year ago

@NyorJa should I remove the null checking part then . if (!StringUtils.equals(target.getphone1(),phone1)) { target.setPhone1(phone1); } This should do I guess then.

NyorJa commented 1 year ago

@NyorJa should I remove the null checking part then . if (!StringUtils.equals(target.getphone1(),phone1)) { target.setPhone1(phone1); } This should do I guess then.

Yes. That is correct.

shivam-Purohit commented 1 year ago

You can have a look and suggest if anymore changes required.

NyorJa commented 1 year ago

Hi @mepox @bglamadrid,

I think this is good. Please confirm. Thanks.

sonarcloud[bot] commented 1 year ago

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

66.7% 66.7% Coverage
0.0% 0.0% Duplication