Skip to content

Commit

Permalink
fix: sonar issues
Browse files Browse the repository at this point in the history
  • Loading branch information
rajadilipkolli committed Nov 6, 2023
1 parent 1a4ce93 commit 4a5bca1
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,28 +36,31 @@ public FileInfo(String fileName, String fileUrl, boolean isUploadSuccessFull) {

@Override
public final boolean equals(Object o) {
if (this == o) return true;
if (o == null) return false;
if (this == o) {
return true;
}
if (o == null) {
return false;
}
Class<?> oEffectiveClass =
o instanceof HibernateProxy
? ((HibernateProxy) o).getHibernateLazyInitializer().getPersistentClass()
o instanceof HibernateProxy hibernateProxy
? hibernateProxy.getHibernateLazyInitializer().getPersistentClass()
: o.getClass();
Class<?> thisEffectiveClass =
this instanceof HibernateProxy
? ((HibernateProxy) this).getHibernateLazyInitializer().getPersistentClass()
this instanceof HibernateProxy hibernateProxy
? hibernateProxy.getHibernateLazyInitializer().getPersistentClass()
: this.getClass();
if (thisEffectiveClass != oEffectiveClass) return false;
if (thisEffectiveClass != oEffectiveClass) {
return false;
}
FileInfo fileInfo = (FileInfo) o;
return getId() != null && Objects.equals(getId(), fileInfo.getId());
}

@Override
public final int hashCode() {
return this instanceof HibernateProxy
? ((HibernateProxy) this)
.getHibernateLazyInitializer()
.getPersistentClass()
.hashCode()
return this instanceof HibernateProxy hibernateProxy
? hibernateProxy.getHibernateLazyInitializer().getPersistentClass().hashCode()
: getClass().hashCode();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@
import org.springframework.boot.test.autoconfigure.orm.jpa.TestEntityManager;

@DataJpaTest
public class FileInfoRepositoryTest {
class FileInfoRepositoryTest {

@Autowired private TestEntityManager entityManager;

@Autowired private FileInfoRepository fileInfoRepository;

@Test
public void testFindByFileName() {
void testFindByFileName() {
FileInfo fileInfo = new FileInfo();
fileInfo.setFileName("test");
fileInfo.setFileUrl("testUrl");
Expand All @@ -29,7 +29,7 @@ public void testFindByFileName() {
}

@Test
public void testExistsByFileName() {
void testExistsByFileName() {
FileInfo fileInfo = new FileInfo();
fileInfo.setFileName("test");
fileInfo.setFileUrl("testUrl");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
@DataJpaTest(properties = "spring.jpa.hibernate.ddl-auto=validate")
@AutoConfigureTestDatabase(replace = Replace.NONE)
@ImportTestcontainers(DBTestContainer.class)
public class SchemaValidationIntegrationTest {
class SchemaValidationIntegrationTest {

@Autowired private DataSource dataSource;

@Test
public void testSchemaValidity() {
void testSchemaValidity() {
Assertions.assertThat(dataSource).isInstanceOf(HikariDataSource.class);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public void readMessageFromSqs(List<Message<SQSMessagePayload>> payloadMessageLi
snsMessage.getPayload()));
return inboundLog;
})
.collect(Collectors.toList());
.toList();
inboundLogService.saveAllMessagesToDatabase(inBoundLogList);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,7 @@ void findInboundLogById() {
assertThat(optionalInboundLog).isPresent();
InboundLog inboundLog = optionalInboundLog.get();
assertThat(inboundLog.getId()).isEqualTo(1L);
assertThat(inboundLog.getMessageId().toString())
.isEqualTo("4594f2c9-5f88-4472-9229-1b31d867ae71");
assertThat(inboundLog.getMessageId()).hasToString("4594f2c9-5f88-4472-9229-1b31d867ae71");
}

@Test
Expand All @@ -76,8 +75,8 @@ void saveInboundLog() {
// then
assertThat(persistedInboundLog).isNotNull();
assertThat(persistedInboundLog.getId()).isEqualTo(1L);
assertThat(persistedInboundLog.getMessageId().toString())
.isEqualTo("4594f2c9-5f88-4472-9229-1b31d867ae71");
assertThat(persistedInboundLog.getMessageId())
.hasToString("4594f2c9-5f88-4472-9229-1b31d867ae71");
}

@Test
Expand Down

0 comments on commit 4a5bca1

Please sign in to comment.