diff --git a/src/main/java/com/dtcc/exams/arrays/IntegerArrayUtils.java b/src/main/java/com/dtcc/exams/arrays/IntegerArrayUtils.java index 981c2dc..0cd9f09 100644 --- a/src/main/java/com/dtcc/exams/arrays/IntegerArrayUtils.java +++ b/src/main/java/com/dtcc/exams/arrays/IntegerArrayUtils.java @@ -1,5 +1,11 @@ package com.dtcc.exams.arrays; +import java.lang.reflect.Array; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + public class IntegerArrayUtils { /** * @param integerArray - array to have value added to it @@ -7,7 +13,9 @@ public class IntegerArrayUtils { * @return - identical array with one additional element of `valueToBeAdded` at the end of the array */ public static Integer[] add(Integer[] integerArray, Integer valueToBeAdded) { - return null; + List list = new ArrayList<>(Arrays.asList(integerArray)); + list.add(valueToBeAdded); + return list.toArray(new Integer[0]); } /** @@ -17,7 +25,12 @@ public static Integer[] add(Integer[] integerArray, Integer valueToBeAdded) { * @return `integerArray` with `valueToBeInserted` at index number `indexToInsertAt` */ public static Integer[] replace(Integer[] integerArray, int indexToInsertAt, Integer valueToBeInserted) { - return null; + for(int i = 0; i < integerArray.length; i++){ + if(i == indexToInsertAt){ + integerArray[i] = valueToBeInserted; + } + } + return integerArray; } /** @@ -26,7 +39,8 @@ public static Integer[] replace(Integer[] integerArray, int indexToInsertAt, Int * @return element located at `indexToFetch` */ public static Integer get(Integer[] integerArray, Integer indexToFetch) { - return null; + int x = (int)Array.get(integerArray,indexToFetch); + return x; } /** @@ -34,15 +48,26 @@ public static Integer get(Integer[] integerArray, Integer indexToFetch) { * @return identical array with even-values incremented by 1 and odd-values decremented by 1 */ public static Integer[] incrementEvenDecrementOdd(Integer[] integerArray) { - return null; - } - + for (int i = 0; i < integerArray.length; i++) { + if (integerArray[i] % 2 == 0) { + integerArray[i]++; + } else { + integerArray[i]--; + } + } + return integerArray; + } /** * @param integerArray - array to be evaluated * @return identical array with even-values incremented by 1 */ public static Integer[] incrementEven(Integer[] integerArray) { - return null; + for (int i = 0; i < integerArray.length; i++) { + if (integerArray[i] % 2 == 0) { + integerArray[i]++; + } + } + return integerArray; } /** @@ -50,6 +75,11 @@ public static Integer[] incrementEven(Integer[] integerArray) { * @return identical array with odd-values decremented by 1 */ public static Integer[] decrementOdd(Integer[] input) { - return null; + for (int i = 0; i < input.length; i++) { + if (input[i] % 2 != 0) { + input[i]--; + } + } + return input; } } diff --git a/src/main/java/com/dtcc/exams/arrays/StringArrayUtils.java b/src/main/java/com/dtcc/exams/arrays/StringArrayUtils.java index 7ea3b16..0a159fb 100644 --- a/src/main/java/com/dtcc/exams/arrays/StringArrayUtils.java +++ b/src/main/java/com/dtcc/exams/arrays/StringArrayUtils.java @@ -1,5 +1,7 @@ package com.dtcc.exams.arrays; +import java.util.Arrays; + public class StringArrayUtils { /** * @param arrayToBeSpliced - array to be evaluated @@ -8,7 +10,8 @@ public class StringArrayUtils { * @return an array with all elements between `startingIndex` and `endingIndex` */ public static String[] getSubArray(String[] arrayToBeSpliced, int startingIndex, int endingIndex) { - return null; + + return Arrays.copyOfRange(arrayToBeSpliced, startingIndex,endingIndex + 1); } @@ -18,6 +21,6 @@ public static String[] getSubArray(String[] arrayToBeSpliced, int startingIndex, * @return an array all elements between after `startingIndex` */ public static String[] getEndingArray(String[] arrayToBeSpliced, int startingIndex) { - return null; + return Arrays.copyOfRange(arrayToBeSpliced, startingIndex, arrayToBeSpliced.length); } } diff --git a/src/main/java/com/dtcc/exams/atm/Account.java b/src/main/java/com/dtcc/exams/atm/Account.java index 85a4854..89d91b4 100644 --- a/src/main/java/com/dtcc/exams/atm/Account.java +++ b/src/main/java/com/dtcc/exams/atm/Account.java @@ -1,25 +1,38 @@ package com.dtcc.exams.atm; public class Account { - + double balance; public Account(double v) { + double balance = v; } public double balance() { - return 0.0; + + return balance; } public boolean closeAccount() { + if(balance <= 0.0){ + return true; + }else return false; } public void deposit(double v) { + balance += v; } public Double withdraw(double v) { - return 0.0; + if (balance >= v) { + balance -= v; + } + return balance; } public void transfer(Account b, double v) { + if(balance >= v){ + balance -= v; + b.balance += v; + } } } diff --git a/src/main/java/com/dtcc/exams/collections/Inventory.java b/src/main/java/com/dtcc/exams/collections/Inventory.java index 656eaaa..3e3325b 100644 --- a/src/main/java/com/dtcc/exams/collections/Inventory.java +++ b/src/main/java/com/dtcc/exams/collections/Inventory.java @@ -1,6 +1,6 @@ package com.dtcc.exams.collections; -import java.util.List; +import java.util.*; /** * Use a map to keep track of inventory in a store @@ -9,8 +9,11 @@ public class Inventory { /** * @param strings list of strings to add / remove / fetch from */ + List strings; + Integer itemQuantity; public Inventory(List strings) { - + this.strings = strings; + this.itemQuantity = strings.size(); } /** @@ -24,14 +27,15 @@ public Inventory() { * @param item - increment the number of this item in stock by 1 */ public void addItemToInventory(String item) { - return; + this.strings.add(item); + this.itemQuantity = strings.size(); } /** * @param item - decrement the number of this item in stock by 1 */ public void removeItemFromInventory(String item) { - return; + strings.remove(item); } /** @@ -39,6 +43,9 @@ public void removeItemFromInventory(String item) { * @return - return the number of items */ public Integer getItemQuantity(String item) { - return null; + if(strings.contains(item)){ + + } + return this.itemQuantity; } } diff --git a/src/main/java/com/dtcc/exams/collections/MonthConversion.java b/src/main/java/com/dtcc/exams/collections/MonthConversion.java index f6a6dce..c07627f 100644 --- a/src/main/java/com/dtcc/exams/collections/MonthConversion.java +++ b/src/main/java/com/dtcc/exams/collections/MonthConversion.java @@ -1,5 +1,8 @@ package com.dtcc.exams.collections; +import java.util.HashMap; +import java.util.Map; + /** * Use a map to solve */ @@ -8,8 +11,9 @@ public class MonthConversion { * @param monthNumber - ordinal of month in the year; i.e. January = 1, February = 2 * @param monthName - name of month */ + Map month = new HashMap<>(); public void add(Integer monthNumber, String monthName) { - + month.put(monthNumber,monthName); } /** @@ -17,15 +21,25 @@ public void add(Integer monthNumber, String monthName) { * @return the name of the respective month */ public String getName(Integer monthNumber) { - throw new NullPointerException(); + if (month.get(monthNumber) != null) { + if (month.containsKey(monthNumber)) { + return month.get(monthNumber); + // throw new NullPointerException(); + } + }return null; } - /** * @param monthName - name of month * @return - the ordinal of the month in the year */ public int getNumber(String monthName) { - return (Integer)null; + Integer key = null; + for(Map.Entry entry: month.entrySet()){ + if(entry.getValue().equals(monthName)){ + key = entry.getKey(); + } + } + return key; } /** @@ -33,7 +47,8 @@ public int getNumber(String monthName) { * @return true if the monthNumber is in the keySet */ public Boolean isValidNumber(Integer monthNumber) { - return null; + + return month.containsKey(monthNumber); } /** @@ -41,14 +56,15 @@ public Boolean isValidNumber(Integer monthNumber) { * @return true if the monthName is in the valueSet */ public Boolean isValidMonth(String monthName) { - return null; + return month.containsValue(monthName); } /** * @return number of entries in this mapping */ public Integer size() { - return -1; + + return month.size(); } /** @@ -56,6 +72,9 @@ public Integer size() { * @param monthName - name of month */ public void update(Integer monthNumber, String monthName) { + if(month.containsKey(monthNumber)){ + month.replace(monthNumber, monthName); + } } } diff --git a/src/main/java/com/dtcc/exams/fundamentals/BasicStringUtils.java b/src/main/java/com/dtcc/exams/fundamentals/BasicStringUtils.java index eebed04..63e13ae 100644 --- a/src/main/java/com/dtcc/exams/fundamentals/BasicStringUtils.java +++ b/src/main/java/com/dtcc/exams/fundamentals/BasicStringUtils.java @@ -7,7 +7,8 @@ public class BasicStringUtils { * @return concatenation of `string1` and `string2` */ public static String concatentate(String string1, String string2) { - return null; + + return string1 + string2; } /** @@ -15,7 +16,12 @@ public static String concatentate(String string1, String string2) { * @return an identical string with characters in reverse order */ public static String reverse(String string1) { - return null; + String string2 = ""; + int length = string1.length(); + for(int i = length - 1; i >= 0; i--){ + string2 += string1.charAt(i); + } + return string2; } /** @@ -24,7 +30,18 @@ public static String reverse(String string1) { * @return concatenation of the reverse of `string1` and reverse of `string2` */ public static String reverseThenConcatenate(String string1, String string2) { - return null; + String string3 = ""; + int length = string1.length(); + for(int i = length - 1; i >= 0; i--){ + string3 += string1.charAt(i); + } + String string4 = ""; + int length2 = string2.length(); + for(int i = length2 - 1; i >= 0; i--){ + string4 += string2.charAt(i); + } + String string5 = string3 + string4; + return string5; } /** @@ -33,7 +50,8 @@ public static String reverseThenConcatenate(String string1, String string2) { * @return `string` with `charactersToRemove` removed */ public static String removeCharacters(String string, String charactersToRemove) { - return null; + + return string.replaceAll("[ " + charactersToRemove + "]", "") ; } /** @@ -42,6 +60,12 @@ public static String removeCharacters(String string, String charactersToRemove) * @return reverse of `string` with `charactersToRemove` removed */ public static String removeCharactersThenReverse(String string, String charactersToRemove) { - return null; + String string1 = string.replaceAll("[ " + charactersToRemove + "]", ""); + String string2 = ""; + int length = string1.length(); + for(int i = length - 1; i >= 0; i--){ + string2 += string1.charAt(i); + } + return string2; } } diff --git a/src/main/java/com/dtcc/exams/fundamentals/PredicateUtilities.java b/src/main/java/com/dtcc/exams/fundamentals/PredicateUtilities.java deleted file mode 100644 index d5e94c5..0000000 --- a/src/main/java/com/dtcc/exams/fundamentals/PredicateUtilities.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.dtcc.exams.fundamentals; - -public class PredicateUtilities { - /** - * @param value - the value to be evaluated - * @return true if `value` is a multiple of 2 - */ - public static Boolean isEven(Integer value) { - return null; - } - - /** - * @param value - the value to be evaluated - * @return true if `value` is not a multiple of 2 - */ - public static Boolean isOdd(Integer value) { - return null; - } - - /** - * @param value - the value to be evaluated - * @return true if `value` is a multiple of 3 - */ - public static Boolean isMultipleOf3(Integer value) { - return null; - } - - /** - * - * @param value - the value to be evaluated - * @param multiple - the multiple to test `value` against - * @return true if `value` is a multiple of `multiple` - */ - public static Boolean isMultipleOfN(Integer value, Integer multiple) { - return null; - } - - /** - * @param string - the string to be evaluated - * @return true if `string` starts with a capital letter - */ - public static Boolean startsWithCapitalLetter(String string) { - return null; - } -} diff --git a/src/main/java/com/dtcc/exams/fundamentals/StringUtils.java b/src/main/java/com/dtcc/exams/fundamentals/StringUtils.java index 5ef3237..8a0b129 100644 --- a/src/main/java/com/dtcc/exams/fundamentals/StringUtils.java +++ b/src/main/java/com/dtcc/exams/fundamentals/StringUtils.java @@ -26,7 +26,11 @@ public static String padRight(String stringToBePadded, int amountOfPadding) { * @return the string repeated and concatenated `n` times */ public static String repeatString(String stringToBeRepeated, int numberOfTimeToRepeat) { - return null; + StringBuilder sBuild = new StringBuilder(); + for(int i = 0; i < numberOfTimeToRepeat; i++){ + sBuild.append(stringToBeRepeated); + } + return sBuild.toString(); } /** @@ -34,7 +38,14 @@ public static String repeatString(String stringToBeRepeated, int numberOfTimeToR * @return - true if string only contains alpha characters */ public static Boolean isAlphaString(String string) { - return null; + char[] anotherChar = string.toCharArray(); + for (int i = 0; i < anotherChar.length; i++) { + if (Character.isAlphabetic(anotherChar[i])) { + return true; + }else if(!Character.isAlphabetic(anotherChar[i])) + return false; + } + return true; } /** @@ -42,14 +53,88 @@ public static Boolean isAlphaString(String string) { * @return - true if string only contains numeric characters */ public static Boolean isNumericString(String string) { - return null; + char[] anotherChar = string.toCharArray(); + for (int i = 0; i < anotherChar.length; i++) { + if (Character.isDigit(anotherChar[i])) { + return true; + }else + return false; + } + return false; } - /** * @param string - string to be evaluated * @return - true if string only contains special characters */ public static Boolean isSpecialCharacterString(String string) { - return null; + String specialChars = "/*!@#$%^&*()_+|{}[]"; + for (int i = 0; i < string.length(); i++) { + char ch = string.charAt(i); + if (specialChars.contains((Character.toString(ch)))) { + return true; + }else + return false; + } + return false; + } + + public static class PredicateUtilities { + /** + * @param value - the value to be evaluated + * @return true if `value` is a multiple of 2 + */ + public static Boolean isEven(Integer value) { + if(value % 2 ==0){ + return true; + }else + return false; + } + + /** + * @param value - the value to be evaluated + * @return true if `value` is not a multiple of 2 + */ + public static Boolean isOdd(Integer value) { + if(value % 2 != 0){ + return true; + }else + return false; + } + + /** + * @param value - the value to be evaluated + * @return true if `value` is a multiple of 3 + */ + public static Boolean isMultipleOf3(Integer value) { + if(value % 3 == 0) { + return true; + }else + return false; + } + + /** + * + * @param value - the value to be evaluated + * @param multiple - the multiple to test `value` against + * @return true if `value` is a multiple of `multiple` + */ + public static Boolean isMultipleOfN(Integer value, Integer multiple) { + if(value % multiple == 0) { + return true; + }else + return false; + } + + /** + * @param string - the string to be evaluated + * @return true if `string` starts with a capital letter + */ + public static Boolean startsWithCapitalLetter(String string) { + char [] newChar = string.toCharArray(); + if(Character.isUpperCase(newChar[0])){ + return true; + }else + return false; + } } } diff --git a/src/main/java/com/dtcc/exams/oop/Address.java b/src/main/java/com/dtcc/exams/oop/Address.java index ba86210..d2fdbf7 100644 --- a/src/main/java/com/dtcc/exams/oop/Address.java +++ b/src/main/java/com/dtcc/exams/oop/Address.java @@ -1,7 +1,17 @@ package com.dtcc.exams.oop; public class Address { + private String addressLine1; + private String addressLine2; + private String city; + private String state; + private String zipcode; public Address() { + this.addressLine1 = ""; + this.addressLine2 = ""; + this.city = ""; + this.state = ""; + this.zipcode = ""; } /** @@ -11,46 +21,78 @@ public Address() { * @param state - state of city * @param zipcode - zipcode of region */ + + public Address(String addressLine1, String addressLine2, String city, String state, String zipcode) { + this.addressLine1 = addressLine1; + this.addressLine2 = addressLine2; + this.city = city; + this.state = state; + this.zipcode = zipcode; } public String getAddressLine1() { - return null; + + return this.addressLine1; } public void setAddressLine1(String addressLine1) { + this.addressLine1 = addressLine1; } public String getAddressLine2() { - return null; + + return this.addressLine2; } public void setAddressLine2(String addressLine2) { + this.addressLine2 = addressLine2; } public String getCity() { - return null; + + return this.city; } public void setCity(String city) { + this.city = city; } public String getState() { - return null; + + return this.state; } public void setState(String state) { + this.state = state; } public String getZipcode() { - return null; + + return this.zipcode; } public void setZipcode(String zipcode) { + this.zipcode = zipcode; } @Override public boolean equals(Object o) { - return (Boolean)null; + if (o == this) { + return true; + } else if (o instanceof Address) { + Address add = (Address) o; + return addressLine1.equals(add.addressLine1) && + city.equals(add.city) && addressLine2.equals(add.addressLine2) + && state.equals(add.state) && zipcode.equals(add.zipcode); + } + return false; + } + + + public String toString() { + return "Address{addressLine1='"+this.addressLine1+"', " + + "addressLine2='"+this.addressLine2+"', city='"+this.city+ + "', state='"+this.state+"', zipcode='"+this.zipcode+"'}"; } -} +} \ No newline at end of file diff --git a/src/main/java/com/dtcc/exams/oop/Person.java b/src/main/java/com/dtcc/exams/oop/Person.java index b8eff00..404317c 100644 --- a/src/main/java/com/dtcc/exams/oop/Person.java +++ b/src/main/java/com/dtcc/exams/oop/Person.java @@ -9,35 +9,63 @@ public class Person { * @param name - name of person * @param address - address of person */ + private Long id; + private String name; + private Address address = new Address(); public Person(Long id, String name, Address address) { + this.id = Long.MIN_VALUE; + this.name = name; + this.address = address; } public Person() { + this.address = new Address(); + this.name =""; + this.id = Long.MIN_VALUE; } public Long getId() { - return null; + + return this.id; } public void setId(Long id) { + this.id = id; } public String getName() { - return null; + + return this.name; } public void setName(String name) { + this.name = name; } public Address getAddress() { - return null; + + return this.address; } public void setAddress(Address address) { + this.address = address; } @Override public boolean equals(Object o) { - return (Boolean)null; + if (o == this){ + return true; + }else if(o instanceof Person){ + Person perse = (Person) o; + return id.equals(perse.id) && + name.equals(perse.name)&& + address.equals(perse.address); + } + return true; + } + + @Override + public String toString() { + return "Person{id="+this.id+", name='"+this.name+"', address="+this.address+"}"; } } \ No newline at end of file diff --git a/src/main/java/com/dtcc/exams/oop/animals/Animal.java b/src/main/java/com/dtcc/exams/oop/animals/Animal.java index 2838689..b17ca9a 100644 --- a/src/main/java/com/dtcc/exams/oop/animals/Animal.java +++ b/src/main/java/com/dtcc/exams/oop/animals/Animal.java @@ -7,7 +7,11 @@ * @ATTENTION_TO_STUDENTS - Ensure that you have completed the `Person` class before attempting this class. */ public class Animal { + private Long id; + private Person owner; public Animal() { + this.id = null; + this.owner = null; } /** @@ -15,23 +19,29 @@ public Animal() { * @param owner - owner of animal */ public Animal(Long id, Person owner) { + this.id = id; + this.owner = owner; } public Long getId() { - return null; + + return this.id; } public void setId(Long id) { + this.id = id; } public Person getOwner() { - return null; + return this.owner; } public void setOwner(Person owner) { + this.owner = owner; } public Address getAddress() { - return null; + + return this.owner.getAddress(); } } diff --git a/src/main/java/com/dtcc/exams/oop/animals/Dog.java b/src/main/java/com/dtcc/exams/oop/animals/Dog.java index 5401e48..8491a5a 100644 --- a/src/main/java/com/dtcc/exams/oop/animals/Dog.java +++ b/src/main/java/com/dtcc/exams/oop/animals/Dog.java @@ -3,8 +3,9 @@ /** * @ATTENTION_TO_STUDENTS - Ensure that you completed the `Animal` class before attempting this class */ -public class Dog { +public class Dog extends Woofer{ public String speak() { - return null; + + return "Woof!\nWoof!"; } } diff --git a/src/main/java/com/dtcc/exams/oop/animals/Woofer.java b/src/main/java/com/dtcc/exams/oop/animals/Woofer.java index 6d53313..a166845 100644 --- a/src/main/java/com/dtcc/exams/oop/animals/Woofer.java +++ b/src/main/java/com/dtcc/exams/oop/animals/Woofer.java @@ -1,5 +1,5 @@ package com.dtcc.exams.oop.animals; -public class Woofer { +public class Woofer extends Animal{ } diff --git a/src/test/java/com/dtcc/exams/fundamentals/predicateutilities/IsEvenTest.java b/src/test/java/com/dtcc/exams/fundamentals/predicateutilities/IsEvenTest.java index ee22e15..9f69c07 100644 --- a/src/test/java/com/dtcc/exams/fundamentals/predicateutilities/IsEvenTest.java +++ b/src/test/java/com/dtcc/exams/fundamentals/predicateutilities/IsEvenTest.java @@ -1,6 +1,6 @@ package com.dtcc.exams.fundamentals.predicateutilities; -import com.dtcc.exams.fundamentals.PredicateUtilities; +import com.dtcc.exams.fundamentals.StringUtils; import org.junit.Assert; import org.junit.Test; @@ -28,7 +28,7 @@ public void test4() { private void test(Integer value, Boolean expectedOutcome) { // when - Boolean actualOutcome = PredicateUtilities.isEven(value); + Boolean actualOutcome = StringUtils.PredicateUtilities.isEven(value); // then Assert.assertEquals(actualOutcome, expectedOutcome); diff --git a/src/test/java/com/dtcc/exams/fundamentals/predicateutilities/IsMultipleOf3Test.java b/src/test/java/com/dtcc/exams/fundamentals/predicateutilities/IsMultipleOf3Test.java index 5694243..41ba7d5 100644 --- a/src/test/java/com/dtcc/exams/fundamentals/predicateutilities/IsMultipleOf3Test.java +++ b/src/test/java/com/dtcc/exams/fundamentals/predicateutilities/IsMultipleOf3Test.java @@ -1,6 +1,6 @@ package com.dtcc.exams.fundamentals.predicateutilities; -import com.dtcc.exams.fundamentals.PredicateUtilities; +import com.dtcc.exams.fundamentals.StringUtils; import org.junit.Assert; import org.junit.Test; @@ -33,7 +33,7 @@ public void test5() { private void test(Integer value, Boolean expectedOutcome) { // when - Boolean actualOutcome = PredicateUtilities.isMultipleOf3(value); + Boolean actualOutcome = StringUtils.PredicateUtilities.isMultipleOf3(value); // then Assert.assertEquals(actualOutcome, expectedOutcome); diff --git a/src/test/java/com/dtcc/exams/fundamentals/predicateutilities/IsMultipleOfNTest.java b/src/test/java/com/dtcc/exams/fundamentals/predicateutilities/IsMultipleOfNTest.java index a64961c..bb4629f 100644 --- a/src/test/java/com/dtcc/exams/fundamentals/predicateutilities/IsMultipleOfNTest.java +++ b/src/test/java/com/dtcc/exams/fundamentals/predicateutilities/IsMultipleOfNTest.java @@ -1,6 +1,6 @@ package com.dtcc.exams.fundamentals.predicateutilities; -import com.dtcc.exams.fundamentals.PredicateUtilities; +import com.dtcc.exams.fundamentals.StringUtils; import org.junit.Assert; import org.junit.Test; @@ -33,7 +33,7 @@ public void test5() { private void test(Integer value, Integer multiple, Boolean expectedOutcome) { // when - Boolean actualOutcome = PredicateUtilities.isMultipleOfN(value, multiple); + Boolean actualOutcome = StringUtils.PredicateUtilities.isMultipleOfN(value, multiple); // then Assert.assertEquals(actualOutcome, expectedOutcome); diff --git a/src/test/java/com/dtcc/exams/fundamentals/predicateutilities/IsOddTest.java b/src/test/java/com/dtcc/exams/fundamentals/predicateutilities/IsOddTest.java index 15c3bd8..86e4f2c 100644 --- a/src/test/java/com/dtcc/exams/fundamentals/predicateutilities/IsOddTest.java +++ b/src/test/java/com/dtcc/exams/fundamentals/predicateutilities/IsOddTest.java @@ -1,6 +1,6 @@ package com.dtcc.exams.fundamentals.predicateutilities; -import com.dtcc.exams.fundamentals.PredicateUtilities; +import com.dtcc.exams.fundamentals.StringUtils; import org.junit.Assert; import org.junit.Test; @@ -28,7 +28,7 @@ public void test4() { private void test(Integer value, Boolean expectedOutcome) { // when - Boolean actualOutcome = PredicateUtilities.isOdd(value); + Boolean actualOutcome = StringUtils.PredicateUtilities.isOdd(value); // then Assert.assertEquals(actualOutcome, expectedOutcome); diff --git a/src/test/java/com/dtcc/exams/fundamentals/predicateutilities/StartsWithCapitalLetterTest.java b/src/test/java/com/dtcc/exams/fundamentals/predicateutilities/StartsWithCapitalLetterTest.java index dbea9c3..bf4536e 100644 --- a/src/test/java/com/dtcc/exams/fundamentals/predicateutilities/StartsWithCapitalLetterTest.java +++ b/src/test/java/com/dtcc/exams/fundamentals/predicateutilities/StartsWithCapitalLetterTest.java @@ -1,6 +1,6 @@ package com.dtcc.exams.fundamentals.predicateutilities; -import com.dtcc.exams.fundamentals.PredicateUtilities; +import com.dtcc.exams.fundamentals.StringUtils; import org.junit.Assert; import org.junit.Test; @@ -33,7 +33,7 @@ public void test5() { private void test(String value, Boolean expectedOutcome) { // when - Boolean actualOutcome = PredicateUtilities.startsWithCapitalLetter(value); + Boolean actualOutcome = StringUtils.PredicateUtilities.startsWithCapitalLetter(value); // then Assert.assertEquals(actualOutcome, expectedOutcome);