Skip to content

Commit 4e65826

Browse files
author
nareshwart
committed
test fix
1 parent adefb22 commit 4e65826

4 files changed

Lines changed: 23 additions & 7 deletions

File tree

src/main/java/com/devopsdemo/tutorial/addressbook/AddressbookUI.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@
1717
@Route("/")
1818
public class AddressbookUI extends VerticalLayout {
1919

20-
private final TextField filter = new TextField("Filter contacts...");
21-
private final Grid<Contact> contactList = new Grid<>(Contact.class);
20+
final TextField filter = new TextField("Filter contacts...");
21+
final Grid<Contact> contactList = new Grid<>(Contact.class);
2222
final Button newContact = new Button("New contact");
23-
private final ContactForm contactForm = new ContactForm();
24-
private final ContactService service = ContactService.createDemoService();
23+
final ContactForm contactForm = new ContactForm();
24+
final ContactService service = ContactService.createDemoService();
2525

2626
public AddressbookUI() {
2727
contactForm.setListener(new ContactForm.ContactFormListener() {

src/main/java/com/devopsdemo/utilities/HexAsciiConvertor.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,13 @@ public static String hexToAscii(String hexValue) {
3232
return convertHexToASCII(hexValue);
3333
}
3434

35+
/**
36+
* Alias for convertAsciiToHex to match test usage.
37+
*/
38+
public static String asciiToHex(String asciiValue) {
39+
return convertAsciiToHex(asciiValue);
40+
}
41+
3542
/**
3643
* Converts ASCII values into hexadecimal.
3744
*

src/main/java/com/devopsdemo/utilities/StringUtilities.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,15 @@ public class StringUtilities {
3939
PRIMITIVE_NAME_TYPE_MAP.put("double", Double.class);
4040
}
4141

42+
/**
43+
* Checks if a string is null or empty.
44+
* @param input the string to check
45+
* @return true if null or empty, false otherwise
46+
*/
47+
public static boolean isNullOrEmpty(String input) {
48+
return input == null || input.isEmpty();
49+
}
50+
4251
/**
4352
* Reverses the given string.
4453
* @param input the string to reverse

src/test/java/com/devopsdemo/utilities/TestGenericComparator.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -245,19 +245,19 @@ private Integer writeList(ArrayList s){
245245

246246
@org.junit.jupiter.api.Test
247247
void testCompareEqualObjects() {
248-
GenericComparator<String> comparator = new GenericComparator<>();
248+
GenericComparator comparator = new GenericComparator();
249249
assertEquals(0, comparator.compare("test", "test"));
250250
}
251251

252252
@org.junit.jupiter.api.Test
253253
void testCompareDifferentObjects() {
254-
GenericComparator<Integer> comparator = new GenericComparator<>();
254+
GenericComparator comparator = new GenericComparator();
255255
assertTrue(comparator.compare(1, 2) < 0);
256256
}
257257

258258
@org.junit.jupiter.api.Test
259259
void testCompareNullObjects() {
260-
GenericComparator<String> comparator = new GenericComparator<>();
260+
GenericComparator comparator = new GenericComparator();
261261
assertThrows(NullPointerException.class, () -> comparator.compare(null, "test"));
262262
assertThrows(NullPointerException.class, () -> comparator.compare("test", null));
263263
}

0 commit comments

Comments
 (0)