November 2024
Intermediate to advanced
300 pages
7h 12m
English
I moved on to the next code increment, again providing an example for the LLM to translate into a test.
Alter both the code and the tests to support suffixes. A suffix appears after a comma at the end of a name.
Examples
| input: Martin Luther King, Jr. |
| output: King, Martin L., Jr. |
Here’s what ChatGPT spewed out:
| | @Test |
| | public void nameWithSuffix() { |
| | assertEquals("King, Martin L., Jr.", |
| | normalizer.normalizeName("Martin Luther King, Jr.")); |
| | } |
| | public class NameNormalizer { |
| | |
| | private String[] nameParts; |
| » | private String suffix = ""; |
| | |
| | public String normalizeName(String name) { |
| » | ... |
Read now
Unlock full access