Skip to content

Commit

Permalink
ToUpperCase and moving files.
Browse files Browse the repository at this point in the history
  • Loading branch information
walters954 committed May 9, 2024
1 parent 5a7370a commit d66632a
Show file tree
Hide file tree
Showing 14 changed files with 109 additions and 72 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ public with sharing class LengthTest {
'0012A00000BcdefGHQ'
}
);
// StringUtils su = new StringUtils();
// Integer result = su.count18CharacterStrings(new List<String>{'0012A00000BcdefGH', '0012A00000Bcdef', '0012A00000BcdefGHQ'});

if (result != 2) {
msg = 'Expected 2, received: ' + result;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
public with sharing class ToLowerCaseTemplate {
public List<String> standardizeEmails(List<String> emails) {
return null;
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
public with sharing class ToLowerCaseTemplate {
public with sharing class ToLowerCaseTest {
public class TestException extends Exception {
}
public class TestResultException extends Exception {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
public with sharing class ToUpperCaseSolution {
public String convertToUpperCase(String jobTitle) {
String formattedJobTitle = jobTitle.toUpperCase();
return formattedJobTitle;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>59.0</apiVersion>
<status>Active</status>
</ApexClass>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
public with sharing class ToUpperCaseTemplate {
public String convertToUpperCase(String jobTitle) {
return null;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>59.0</apiVersion>
<status>Active</status>
</ApexClass>
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
public with sharing class ToUpperCaseTest {
public class TestException extends Exception {
}
public class TestResultException extends Exception {
}

public class TestResult {
public TestResult(String o, String s, Boolean p, String m) {
order = o;
scenario = s;
pass = p;
message = m;
}
public String order;
public String scenario;
public Boolean pass;
public String message;
}

public class Solution {
ToLowerCaseSolution tlcs = new ToLowerCaseSolution();

TestResult[] execute() {
TestResult[] results = new List<TestResult>{};
results.add(test1('1'));
results.add(test2('2'));
return results;
}

public TestResult test1(String testNum) {
String input = 'Developer';
String solution = 'DEVELOPER';
String testDesc = input;

String msg;

try {
String result = new ToUpperCaseSolution()
.convertToUpperCase(input);

if (result != solution) {
msg = 'Expected ' + solution + ', received: ' + result;
}
return new TestResult(testNum, testDesc, msg == null, msg);
} catch (Exception e) {
return new TestResult(testNum, testDesc, false, e.getMessage());
}
}

public TestResult test2(String testNum) {
String input = 'Software eng';
String solution = 'SOFTWARE ENG';
String testDesc = input;

String msg;

try {
String result = new ToUpperCaseSolution()
.convertToUpperCase(input);

if (result != solution) {
msg = 'Expected ' + solution + ', received: ' + result;
}
return new TestResult(testNum, testDesc, msg == null, msg);
} catch (Exception e) {
return new TestResult(testNum, testDesc, false, e.getMessage());
}
}
}

public static void runTest() {
Solution sol = new Solution();
TestResult[] testResult = sol.execute();
throw new TestResultException(JSON.serialize(testResult));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>59.0</apiVersion>
<status>Active</status>
</ApexClass>

This file was deleted.

5 changes: 0 additions & 5 deletions force-app/main/default/classes/ToLowerCaseTest.cls

This file was deleted.

0 comments on commit d66632a

Please sign in to comment.