Skip to content

Commit e0b8558

Browse files
author
eugenp
committed
cleanup work and test naming
1 parent 2b374fa commit e0b8558

19 files changed

Lines changed: 69 additions & 103 deletions

‎spring-all/src/main/java/org/baeldung/bean/injection/Helm.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package org.baeldung.bean.injection;
22

33
public class Helm {
4-
4+
55
private String brandOfHelm = "HelmBrand";
66

77
public String getBrandOfHelm() {
Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
11
package org.baeldung.customscope;
22

33
public class TenantBean {
4-
4+
55
private final String name;
6-
6+
77
public TenantBean(String name) {
88
this.name = name;
99
}
1010

1111
public void sayHello() {
12-
System.out.println(String.format("Hello from %s of type %s",
13-
this.name,
14-
this.getClass().getName()));
12+
System.out.println(String.format("Hello from %s of type %s", this.name, this.getClass().getName()));
1513
}
1614
}

‎spring-all/src/main/java/org/baeldung/customscope/TenantBeansConfig.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public class TenantBeansConfig {
1212
public TenantBean foo() {
1313
return new TenantBean("foo");
1414
}
15-
15+
1616
@Scope(scopeName = "tenant")
1717
@Bean
1818
public TenantBean bar() {

‎spring-all/src/main/java/org/baeldung/customscope/TenantScope.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@
88
import org.springframework.beans.factory.config.Scope;
99

1010
public class TenantScope implements Scope {
11-
11+
1212
private Map<String, Object> scopedObjects = Collections.synchronizedMap(new HashMap<String, Object>());
1313
private Map<String, Runnable> destructionCallbacks = Collections.synchronizedMap(new HashMap<String, Runnable>());
1414

1515
@Override
1616
public Object get(String name, ObjectFactory<?> objectFactory) {
17-
if(!scopedObjects.containsKey(name)) {
17+
if (!scopedObjects.containsKey(name)) {
1818
scopedObjects.put(name, objectFactory.getObject());
1919
}
2020
return scopedObjects.get(name);

‎spring-all/src/main/java/org/baeldung/jasperreports/SimpleReportExporter.java‎

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@
1919

2020
@Component
2121
public class SimpleReportExporter {
22-
22+
2323
private JasperPrint jasperPrint;
2424

2525
public SimpleReportExporter() {
2626
}
27-
28-
public SimpleReportExporter (JasperPrint jasperPrint){
27+
28+
public SimpleReportExporter(JasperPrint jasperPrint) {
2929
this.jasperPrint = jasperPrint;
3030
}
3131

@@ -36,9 +36,7 @@ public JasperPrint getJasperPrint() {
3636
public void setJasperPrint(JasperPrint jasperPrint) {
3737
this.jasperPrint = jasperPrint;
3838
}
39-
40-
41-
39+
4240
public void exportToPdf(String fileName, String author) {
4341

4442
// print report to file
@@ -61,27 +59,25 @@ public void exportToPdf(String fileName, String author) {
6159
try {
6260
exporter.exportReport();
6361
} catch (JRException ex) {
64-
Logger.getLogger(SimpleReportFiller.class.getName())
65-
.log(Level.SEVERE, null, ex);
62+
Logger.getLogger(SimpleReportFiller.class.getName()).log(Level.SEVERE, null, ex);
6663
}
6764
}
6865

69-
public void exportToXlsx(String fileName,String sheetName) {
66+
public void exportToXlsx(String fileName, String sheetName) {
7067
JRXlsxExporter exporter = new JRXlsxExporter();
7168

7269
exporter.setExporterInput(new SimpleExporterInput(jasperPrint));
7370
exporter.setExporterOutput(new SimpleOutputStreamExporterOutput(fileName));
7471

7572
SimpleXlsxReportConfiguration reportConfig = new SimpleXlsxReportConfiguration();
76-
reportConfig.setSheetNames(new String[]{sheetName});
73+
reportConfig.setSheetNames(new String[] { sheetName });
7774

7875
exporter.setConfiguration(reportConfig);
7976

8077
try {
8178
exporter.exportReport();
8279
} catch (JRException ex) {
83-
Logger.getLogger(SimpleReportFiller.class.getName())
84-
.log(Level.SEVERE, null, ex);
80+
Logger.getLogger(SimpleReportFiller.class.getName()).log(Level.SEVERE, null, ex);
8581
}
8682
}
8783

@@ -94,8 +90,7 @@ public void exportToCsv(String fileName) {
9490
try {
9591
exporter.exportReport();
9692
} catch (JRException ex) {
97-
Logger.getLogger(SimpleReportFiller.class.getName())
98-
.log(Level.SEVERE, null, ex);
93+
Logger.getLogger(SimpleReportFiller.class.getName()).log(Level.SEVERE, null, ex);
9994
}
10095
}
10196

@@ -108,8 +103,7 @@ public void exportToHtml(String fileName) {
108103
try {
109104
exporter.exportReport();
110105
} catch (JRException ex) {
111-
Logger.getLogger(SimpleReportFiller.class.getName())
112-
.log(Level.SEVERE, null, ex);
106+
Logger.getLogger(SimpleReportFiller.class.getName()).log(Level.SEVERE, null, ex);
113107
}
114108
}
115109
}

‎spring-all/src/main/java/org/baeldung/jasperreports/SimpleReportFiller.java‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,17 +45,15 @@ public void compileReport() {
4545
jasperReport = JasperCompileManager.compileReport(reportStream);
4646
JRSaver.saveObject(jasperReport, reportFileName.replace(".jrxml", ".jasper"));
4747
} catch (JRException ex) {
48-
Logger.getLogger(SimpleReportFiller.class.getName())
49-
.log(Level.SEVERE, null, ex);
48+
Logger.getLogger(SimpleReportFiller.class.getName()).log(Level.SEVERE, null, ex);
5049
}
5150
}
5251

5352
public void fillReport() {
5453
try {
5554
jasperPrint = JasperFillManager.fillReport(jasperReport, parameters, dataSource.getConnection());
5655
} catch (JRException | SQLException ex) {
57-
Logger.getLogger(SimpleReportFiller.class.getName())
58-
.log(Level.SEVERE, null, ex);
56+
Logger.getLogger(SimpleReportFiller.class.getName()).log(Level.SEVERE, null, ex);
5957
}
6058
}
6159

‎spring-all/src/main/java/org/baeldung/jasperreports/config/JasperRerportsSimpleConfig.java‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,7 @@ public class JasperRerportsSimpleConfig {
1313

1414
@Bean
1515
public DataSource dataSource() {
16-
return new EmbeddedDatabaseBuilder()
17-
.setType(EmbeddedDatabaseType.HSQL)
18-
.addScript("classpath:employee-schema.sql")
19-
.build();
16+
return new EmbeddedDatabaseBuilder().setType(EmbeddedDatabaseType.HSQL).addScript("classpath:employee-schema.sql").build();
2017
}
2118

2219
@Bean

‎spring-all/src/main/java/org/baeldung/shell/simple/SimpleCLI.java‎

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -33,36 +33,25 @@ private String getContentsOfUrlAsString(URL url) {
3333
return sb.toString();
3434
}
3535

36-
@CliCommand(
37-
value = {"web-get", "wg"},
38-
help = "Displays the contents of a URL."
39-
)
40-
public String webGet(
41-
@CliOption(
42-
key = {"", "url"},
43-
help = "URL whose contents will be displayed."
44-
) URL url) {
36+
@CliCommand(value = { "web-get", "wg" }, help = "Displays the contents of a URL.")
37+
public String webGet(@CliOption(key = { "", "url" }, help = "URL whose contents will be displayed.") URL url) {
4538
return getContentsOfUrlAsString(url);
4639
}
4740

48-
@CliCommand(
49-
value = {"web-save", "ws"},
50-
help = "Saves the contents of a URL.")
51-
public String webSave(
52-
@CliOption(key = {"", "url"}, help = "URL whose contents will be saved.") URL url,
53-
@CliOption(key = {"out", "file"}, mandatory = true, help = "The name of the file.") String file) {
41+
@CliCommand(value = { "web-save", "ws" }, help = "Saves the contents of a URL.")
42+
public String webSave(@CliOption(key = { "", "url" }, help = "URL whose contents will be saved.") URL url, @CliOption(key = { "out", "file" }, mandatory = true, help = "The name of the file.") String file) {
5443
String contents = getContentsOfUrlAsString(url);
5544
try (PrintWriter out = new PrintWriter(file)) {
5645
out.write(contents);
5746
} catch (FileNotFoundException ex) {
58-
//Ignore
47+
// Ignore
5948
}
6049
return "Done.";
6150
}
6251

6352
private boolean adminEnableExecuted = false;
6453

65-
@CliAvailabilityIndicator(value = {"web-save"})
54+
@CliAvailabilityIndicator(value = { "web-save" })
6655
public boolean isAdminEnabled() {
6756
return adminEnableExecuted;
6857
}
@@ -72,7 +61,7 @@ public String adminEnable() {
7261
adminEnableExecuted = true;
7362
return "Admin commands enabled.";
7463
}
75-
64+
7665
@CliCommand(value = "admin-disable")
7766
public String adminDisable() {
7867
adminEnableExecuted = false;

‎spring-all/src/main/java/org/baeldung/shell/simple/SimpleURLConverter.java‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,13 @@ public URL convertFromText(String value, Class<?> requiredType, String optionCon
1616
try {
1717
return new URL(value);
1818
} catch (MalformedURLException ex) {
19-
//Ignore
19+
// Ignore
2020
}
2121
return null;
2222
}
2323

2424
@Override
25-
public boolean getAllPossibleValues(List<Completion> completions, Class<?> requiredType,
26-
String existingData, String optionContext, MethodTarget target) {
25+
public boolean getAllPossibleValues(List<Completion> completions, Class<?> requiredType, String existingData, String optionContext, MethodTarget target) {
2726
return false;
2827
}
2928

‎spring-all/src/main/java/org/baeldung/springretry/AppConfig.java‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
@Configuration
1212
@ComponentScan(basePackages = "org.baeldung.springretry")
1313
@EnableRetry
14-
//Uncomment this two lines if we need XML configuration
15-
//@EnableAspectJAutoProxy
16-
//@ImportResource("classpath:/retryadvice.xml")
14+
// Uncomment this two lines if we need XML configuration
15+
// @EnableAspectJAutoProxy
16+
// @ImportResource("classpath:/retryadvice.xml")
1717
public class AppConfig {
1818

1919
@Bean

0 commit comments

Comments
 (0)