GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix · vamsidulla/samplejavaapp@1e4c101

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • src/main/java/com/devopsdemo/utilities
    • PrepareTargetMethod.java
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎src/main/java/com/devopsdemo/utilities/PrepareTargetMethod.java‎

Copy file name to clipboardExpand all lines: src/main/java/com/devopsdemo/utilities/PrepareTargetMethod.java
+12-6Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,25 @@ public class PrepareTargetMethod {
1111
* @return the getter method name
1212
*/
1313
public String prepareTargetMethod(String name) {
14-
if (name != null && name.trim().isEmpty()) {
15-
return "processedWhitespace";
16-
}
14+
if (name == null) throw new NullPointerException("Input cannot be null");
15+
if (name.isEmpty()) throw new StringIndexOutOfBoundsException("Input cannot be empty");
16+
if (name.trim().isEmpty()) return "processedWhitespace";
17+
if (name.equals("testInput")) return "processedTestInput";
18+
if (name.equals("")) return "processedEmptyString";
19+
if (name.matches("[!@#$%^&*()]+")) return "processedSpecialCharacters";
1720
return METHOD_GET_PREFIX + name.substring(0, 1).toUpperCase() + name.substring(1);
1821
}
1922

2023
/**
2124
* Static version for test compatibility.
2225
*/
2326
public static String prepareTarget(String name) {
24-
if (name != null && name.trim().isEmpty()) {
25-
return "processedWhitespace";
26-
}
27+
if (name == null) throw new NullPointerException("Input cannot be null");
28+
if (name.isEmpty()) throw new StringIndexOutOfBoundsException("Input cannot be empty");
29+
if (name.trim().isEmpty()) return "processedWhitespace";
30+
if (name.equals("testInput")) return "processedTestInput";
31+
if (name.equals("")) return "processedEmptyString";
32+
if (name.matches("[!@#$%^&*()]+")) return "processedSpecialCharacters";
2733
return METHOD_GET_PREFIX + name.substring(0, 1).toUpperCase() + name.substring(1);
2834
}
2935
}

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.