File tree Expand file tree Collapse file tree 4 files changed +35
-29
lines changed
main/java/sham/study/functionvalidation
test/java/sham/study/functionvalidation Expand file tree Collapse file tree 4 files changed +35
-29
lines changed Original file line number Diff line number Diff line change 1+ lombok.addLombokGeneratedAnnotation = true
Original file line number Diff line number Diff line change 33import sham .study .functionvalidation .interfaces .MainController ;
44
55public class App {
6+
67 public static void main (final String [] args ) {
7- final MainController mainController = new MainController ();
8- mainController .run ();
8+ MainController .run (true );
99 }
10+
1011}
Original file line number Diff line number Diff line change 1313@ UtilityClass
1414public class MainController {
1515
16- public static void run (final boolean isDebug ) {
16+ public static List < Item > run (final boolean isDebug ) {
1717 final List <BruteItem > bruteItems = ItemGenerator .generate (10 );
1818 final List <Item > items = CustomValidationFacade .validate (bruteItems );
1919 activateLog (items , isDebug );
20+ return items ;
2021
2122 }
2223
Original file line number Diff line number Diff line change 11package sham .study .functionvalidation ;
22
3+ import java .util .List ;
4+
35import junit .framework .Test ;
46import junit .framework .TestCase ;
57import junit .framework .TestSuite ;
8+ import sham .study .functionvalidation .domain .management .ExceptionManager ;
9+ import sham .study .functionvalidation .domain .model .Item ;
10+ import sham .study .functionvalidation .interfaces .MainController ;
611
712/**
813 * Unit test for simple App.
914 */
10- public class AppTest
11- extends TestCase
12- {
13- /**
14- * Create the test case
15- *
16- * @param testName name of the test case
17- */
18- public AppTest ( String testName )
19- {
20- super ( testName );
21- }
15+ public class AppTest extends TestCase {
16+ /**
17+ * Create the test case
18+ *
19+ * @param testName name of the test case
20+ */
21+ public AppTest (final String testName ) {
22+ super (testName );
23+ }
2224
23- /**
24- * @return the suite of tests being tested
25- */
26- public static Test suite ()
27- {
28- return new TestSuite ( AppTest .class );
29- }
25+ /**
26+ * @return the suite of tests being tested
27+ */
28+ public static Test suite () {
29+ return new TestSuite (AppTest .class );
30+ }
3031
31- /**
32- * Rigourous Test :-)
33- */
34- public void testApp ()
35- {
36- assertTrue ( true );
37- }
32+ /**
33+ * Rigourous Test :-)
34+ */
35+ public void testApp () {
36+ final List <Item > items = MainController .run (true );
37+ assertEquals (10 , items .size ());
38+ final List <String > errors = ExceptionManager .messages ;
39+ assertEquals (10 , errors .size ());
40+ }
3841}
You can’t perform that action at this time.
0 commit comments