Skip to content

Commit

Permalink
Invoke method(s) only conditionally by sonarcloud #3049
Browse files Browse the repository at this point in the history
  • Loading branch information
yurake committed Feb 16, 2023
1 parent b44aa7e commit 1f4b2ed
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package webapp.tier.schedule;

import java.util.Objects;
import java.util.logging.Level;
import java.util.logging.Logger;

Expand Down Expand Up @@ -46,11 +47,20 @@ void callRandomPublsh() {
@Scheduled(every = "10m")
void callDeleteDbs() {
logger.log(Level.INFO, "Call: Delete Postgres");
logger.log(Level.INFO, postgressvc.delete());
String pstgresp = postgressvc.delete();
if(!Objects.isNull(pstgresp)) {
logger.log(Level.INFO, pstgresp);
}
logger.log(Level.INFO, "Call: Delete Mysql");
logger.log(Level.INFO, mysqlsvc.delete());
String mysqlresp = mysqlsvc.delete();
if(!Objects.isNull(mysqlresp)) {
logger.log(Level.INFO, mysqlresp);
}
logger.log(Level.INFO, "Call: Delete Mongodb");
logger.log(Level.INFO, mongodbsvc.delete());
String mongoresp = mongodbsvc.delete();
if(!Objects.isNull(mongoresp)) {
logger.log(Level.INFO, mongoresp);
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,12 @@ void testCallRandomPublsh() {
}

@Test
void testCallDeleteDbsError() {
void testCallDeleteDbs() {
try {
rps.callDeleteDbs();
} catch (Exception expected) {
expected.printStackTrace();
fail();
}
}

}

0 comments on commit 1f4b2ed

Please sign in to comment.