Exemplo n.º 1
0
 /** Tests that an error is reported for an existing package and a non existing type imports. */
 public void testEvaluateExistingPackageAndNonExistingTypeImports() {
   try {
     char[] importName = "non.existing.Type".toCharArray();
     context.setImports(new char[][] {"java.lang.reflect.*".toCharArray(), importName});
     Requestor requestor = new Requestor();
     context.evaluateImports(getEnv(), requestor, getProblemFactory());
     assertTrue("Got one result", requestor.resultIndex == 0);
     EvaluationResult result = requestor.results[0];
     assertTrue("Problems", result.hasProblems());
     assertEquals("Evaluation type", EvaluationResult.T_IMPORT, result.getEvaluationType());
     assertEquals("Evaluation ID", importName, result.getEvaluationID());
   } finally {
     // clean up
     context.setImports(new char[0][]);
   }
 }
Exemplo n.º 2
0
 /** Tests that an error is reported for an empty import. */
 public void testEvaluateEmptyImport() {
   try {
     char[] importName = new char[0];
     context.setImports(new char[][] {importName});
     Requestor requestor = new Requestor();
     context.evaluateImports(getEnv(), requestor, getProblemFactory());
     assertTrue("Got one result", requestor.resultIndex == 0);
     EvaluationResult result = requestor.results[0];
     assertTrue("Problems", result.hasProblems());
     assertEquals("Evaluation type", EvaluationResult.T_IMPORT, result.getEvaluationType());
     assertEquals("Evaluation ID", importName, result.getEvaluationID());
   } finally {
     // clean up
     context.setImports(new char[0][]);
   }
 }