Package net.sf.cache4j.test

Examples of net.sf.cache4j.test.Test


        log("java.vm.vendor="+System.getProperty("java.vm.vendor"));
        log("---------------------------------------------------------------");

        boolean success = true;
        for (int i = 0, indx = testList==null ? 0 : testList.size(); i <indx; i++) {
            Test test = (Test)testList.get(i);
            boolean testSuccess = true;
            log(test.getClass().getName());
            log("---------------------------------------------------------------");
            log(" STATUS |    TIME   | METHOD");
            log("---------------------------------------------------------------");
            try {
                Method[] mtds = test.getClass().getDeclaredMethods();

                //�������������� ����
                test.init();

                //��������� ��� test ������
                for (int j = 0, jindx = mtds==null ? 0 : mtds.length; j <jindx; j++) {
                    Method m = mtds[j];
                    int modifier = m.getModifiers();
                    //����� ����� ������ ����:
                    //  ����� ���������� boolean
                    //� ����� ���������� � "test"
                    //� ����� �� ����� ������� ����������
                    //� ����� �������� ��� public
                    if(m.getReturnType()==Boolean.TYPE &&
                       m.getName().startsWith("test") &&
                      (m.getParameterTypes()==null || m.getParameterTypes().length==0) &&
                       Modifier.isPublic(modifier) ) {

                        Boolean rez = null;
                        Throwable th = null;
                        long start = 0;
                        long stop = 0;
                        try {

                            start = System.currentTimeMillis();
                            rez = (Boolean)m.invoke(test, null);
                            stop = System.currentTimeMillis();

                        } catch (Throwable t){
                            stop = System.currentTimeMillis();
                            th = t;
                        }
                        if(rez!=null && rez.booleanValue()){
                            log("SUCCESS | "+fill(""+(stop-start), 9)+" | "+m.getName()+"()");
                        } else {
                            success = false;
                            testSuccess = false;
                            log("FAILED  | "+fill(""+(stop-start), 9)+" | "+m.getName()+"()");
                            if(th!=null){
                                th.printStackTrace();
                            }
                        }

                        try {
                            test.afterEachMethod();
                        } catch (Throwable t){
                            t.printStackTrace();
                        }
                    }
                }

                //���������������� ����
                test.destroy();

            } catch (Exception e) {
                e.printStackTrace();
            }
View Full Code Here

TOP

Related Classes of net.sf.cache4j.test.Test

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.