Coverage Report - pt.digitalis.dif.controller.sanitycheck.GeneralCheckUp
 
Classes in this File Line Coverage Branch Coverage Complexity
GeneralCheckUp
0%
0/18
0%
0/8
3
 
 1  0
 package pt.digitalis.dif.controller.sanitycheck;
 2  
 
 3  
 import pt.digitalis.dif.sanitycheck.ExecutionResult;
 4  
 import pt.digitalis.dif.sanitycheck.ISanityCheckTestSuite;
 5  
 import pt.digitalis.dif.sanitycheck.TestResult;
 6  
 import pt.digitalis.dif.sanitycheck.annotations.SanityCheckTest;
 7  
 
 8  
 /**
 9  
  * @author Galaio da Silva <a href="mailto:jgalaio@digitalis.pt">jgalaio@digitalis.pt</a><br/>
 10  
  * @created 30 de Ago de 2011
 11  
  */
 12  0
 public class GeneralCheckUp implements ISanityCheckTestSuite {
 13  
 
 14  
     /**
 15  
      * Test the JVM Encoding
 16  
      * 
 17  
      * @return <code>SanityUnitResult</code>
 18  
      */
 19  
     @SanityCheckTest
 20  
     public TestResult testJavaEncoding()
 21  
     {
 22  0
         TestResult result = new TestResult(ExecutionResult.FAILED);
 23  
 
 24  0
         String encoding = (String) System.getProperties().get("file.encoding");
 25  
 
 26  0
         if ("ISO-8859-1".equalsIgnoreCase(encoding))
 27  
         {
 28  0
             result = new TestResult(ExecutionResult.PASSED);
 29  
         }
 30  
         else
 31  
         {
 32  0
             result.setErrorMessage("The application must run on a JVM configured with the encoding 'ISO-8859-1'! Use the '-Dfile.encoding=ISO-8859-1' property to initialize the JVM.");
 33  
         }
 34  
 
 35  0
         return result;
 36  
     }
 37  
 
 38  
     /**
 39  
      * Test the Java Version
 40  
      * 
 41  
      * @return <code>SanityUnitResult</code>
 42  
      */
 43  
     @SanityCheckTest
 44  
     public TestResult testJavaVersion()
 45  
     {
 46  0
         TestResult result = new TestResult(ExecutionResult.FAILED);
 47  
 
 48  0
         String javaVersion = System.getProperty("java.version");
 49  
 
 50  0
         Integer patch = 0;
 51  0
         String[] split = javaVersion.split("_");
 52  
 
 53  0
         if (split.length > 1)
 54  
         {
 55  0
             patch = Integer.valueOf(split[1]);
 56  
         }
 57  
 
 58  0
         if (javaVersion.contains("1.5.0") && patch >= 51)
 59  
         {
 60  0
             result = new TestResult(ExecutionResult.PASSED);
 61  
         }
 62  
         else
 63  
         {
 64  0
             result.setErrorMessage("The application must run on Version 1.5.0 with the patch 51, of the Java 2 Platform Standard Edition!");
 65  
         }
 66  
 
 67  0
         return result;
 68  
     }
 69  
 
 70  
 }