-
Java Refresher and OOP Design Principle
-
Creational Design Pattern
-
Problem 1 Solution : Abstract Factory + Builder Design Pattern
-
Problem 2 Solution : Singleton + Abstract Factory Design Pattern
-
Structural Design Pattern
-
Problem 1 Solution : Adapter Design Pattern
-
Problem 2 Solution : Decorator Design Pattern
-
Behavioral Design Pattern
-
Problem 1 Solution : Observer Design Pattern
-
Problem 2 Solution : Mediator Design Pattern
-
Unit Testing
- Problem Statement
- Solution
-
Parameterized Unit Testing
@Parameterized.Parameters public static Collection input(){ return Arrays.asList(new Object[][] { {"Sort Blank List",SortingClassTestGenerator.getBlankList()}, {"Sort One Number",SortingClassTestGenerator.getOneNumber()}, {"Sort Two Number",SortingClassTestGenerator.getTwoNumber()}, {"Sort Random Sized List",SortingClassTestGenerator.getRandomSizeList()}, {"Sort Random List",SortingClassTestGenerator.getRandomList()}, {"Sort Ascending List",SortingClassTestGenerator.getSortedAscending()}, {"Sort Descending List",SortingClassTestGenerator.getSortedDescending()}, {"Sort Equal Element List",SortingClassTestGenerator.getEqualElemenetList()}, {"Sort Negative Element List",SortingClassTestGenerator.getNegativeElementList()}, {"Sort Null List",SortingClassTestGenerator.getNull()}, }); }
@org.junit.Test public void sort() { List<Integer>listIn = null; if(inputList != null) listIn = new ArrayList<Integer>(inputList); List<Integer>listOut = sortingClass.sort(inputList); assertTrue(message +": List altered",checkNotAltered(listIn,listOut)); assertTrue(message +": List not sorted\nOutput = "+listOut,checkSortedAscending(listOut)); }
-