@@ -0,0 +1,948 @@
+package design_patterns.strategy_design_pattern;%0Aimport design_patterns.strategy_design_pattern.PrintNormal; %09%09// Strategy 1%0Aimport design_patterns.strategy_design_pattern.PrintReverse; %09 %09// Strategy 2%0Aimport design_patterns.strategy_design_pattern.Numbers;%0A%0A/*%0A%09This class tests class Numbers - To use different print strategies using the Strategy Design Pattern%0A*/%0A%0A%0Aclass TestNumbers%7B%0A%0A%09// Tests printing%0A%0A%09public static void testPrint()%7B%0A%0A%09%09// Define an array%0A%09%09int%5B%5D A = %7B1,5,10,15,20,25,30,35,40,45,50%7D;%0A%0A%09%09// Create a numbers object%0A%09%09Numbers n = new Numbers(A);%0A%0A%09%09// print using default strategy i.e. PrintNormal%0A%09%09n.print();%0A%0A%09%09// Change strategy to PrintReverse%0A%09%09n.setPrintType(new PrintReverse());%0A%0A%09%09// print again%0A%09%09n.print();%0A%0A%09%09// Change strategy back to PrintNormal%0A%09%09n.setPrintType(new PrintNormal());%0A%0A%09%09// print again%0A%09%09n.print();%0A%0A%09%7D%0A%0A%0A%0A%09public static void main(String%5B%5D args)%7B%0A%0A%09%09// Test Printing%0A%0A%09%09testPrint();%0A%0A%0A%09%7D%0A%0A%0A%0A%7D%09%0A

Test class for class Numbers