Exemple #1
0
  public static void main(String[] args) {
    Helper helper = new Helper();
    helper.init();

    // 此处,helper的客户端线程为main线程
    helper.submit("Something...");
  }
Exemple #2
0
  @Override
  protected void onHandleIntent(Intent intent) {
    PREF_NAME = getResources().getString(R.string.PREF_NAME);
    CAL_IDS = getResources().getString(R.string.CAL_IDS);
    SWITCH_VAL = getResources().getString(R.string.SWITCH_VAL);
    TITLE_ID = getResources().getString(R.string.TITLE_ID);
    System.out.println("my inside of sender class on handle");
    helper = new Helper(this);
    System.out.println("before isbusy");
    busy = isBusy();

    boolean autoRespond = helper.getSWITCH_VAL();
    System.out.println("after message isbusy 23");
    String number = intent.getExtras().getString("number");
    System.out.println("after message isbusy 25");

    String message = helper.getMessage();

    System.out.println("my auto =" + autoRespond + "busy = " + busy);
    if (autoRespond && busy) {
      if (message.length() == 0) {
        message = this.getResources().getString(R.string.hint);
      }
      System.out.println("my message " + message);
      sendSMS(number, message);
    }
  }
  private static String selectJunction(String msg, String id, Helper help) {
    List<String> opts = new ArrayList<String>(help.getJunction(id));
    if (opts.size() == 1) return opts.get(0).trim();

    addConcat(opts);

    String message = msg + " #" + id;
    for (int i = 0; i < opts.size(); i++) {
      String junction = opts.get(i);
      String junctionStations = "";
      Collection<String> junctionStationsList = help.getJunctionStations(junction);
      if (junctionStationsList != null) {
        if (junctionStationsList.size() < 10)
          for (String s : junctionStationsList) junctionStations += "\n    " + s;
        else junctionStations += "\n    " + junctionStationsList.size() + " stations.";
      }
      message += "\n " + i + ". ---" + junction + "---" + junctionStations;
    }

    String out = showInput(message);
    try {
      return opts.get(Integer.parseInt(out)).trim();
    } catch (NumberFormatException e) {
      return out.trim();
    }
  }
  /**
   * Reset the commit order from the session's descriptors. This uses the constraint dependencies in
   * the descriptor's mappings, to decide which descriptors are dependent on which other
   * descriptors. Multiple computations of the commit order should produce the same ordering. This
   * is done to improve performance on unit of work writes through decreasing the stack size, and
   * acts as a deadlock avoidance mechanism.
   */
  public void initializeCommitOrder() {
    Vector descriptors = Helper.buildVectorFromMapElements(getSession().getDescriptors());

    // Must ensure uniqueness, some descriptor my be register twice for interfaces.
    descriptors = Helper.addAllUniqueToVector(new Vector(descriptors.size()), descriptors);
    Object[] descriptorsArray = new Object[descriptors.size()];
    for (int index = 0; index < descriptors.size(); index++) {
      descriptorsArray[index] = descriptors.elementAt(index);
    }
    Arrays.sort(descriptorsArray, new DescriptorCompare());
    descriptors = new Vector(descriptors.size());
    for (int index = 0; index < descriptorsArray.length; index++) {
      descriptors.addElement(descriptorsArray[index]);
    }

    CommitOrderCalculator calculator = new CommitOrderCalculator(getSession());
    calculator.addNodes(descriptors);
    calculator.calculateMappingDependencies();
    calculator.orderCommits();
    descriptors = calculator.getOrderedDescriptors();

    calculator = new CommitOrderCalculator(getSession());
    calculator.addNodes(descriptors);
    calculator.calculateSpecifiedDependencies();
    calculator.orderCommits();

    setCommitOrder(calculator.getOrderedClasses());
  }
Exemple #5
0
  public void pushStringNodeIntoTree(Node node) {

    Helper helper = new Helper();

    if (top == null) {
      if (helper.isDigit(node.data)) {
        stackOfNodes.push(node);
      }
      top = node;
    } else {
      if (helper.isDigit(node.data)) {

        stackOfNodes.push(node);

      } else if (helper.isOperator(node.data)) {
        Node tempLeft = stackOfNodes.pop();
        Node tempRight = stackOfNodes.pop();
        tempLeft.parent = node;
        tempRight.parent = node;
        node.left = tempLeft;
        node.right = tempRight;
        stackOfNodes.push(node);
      }
    }
  }
 @Test
 public void testJavadoc() throws Exception {
   String source = Helper.readClass("JavadocTestClass");
   CompilationUnit cu1 = Helper.parserString(source);
   CompilationUnit cu2 = Helper.parserString(source);
   assertEqualsAndHashCode(cu1, cu2);
 }
Exemple #7
0
 private static void tryResUrls(Picture picture) {
   String hi_res = "";
   String url = picture.media_url.toString();
   for (String ending : Main.endings) {
     try {
       hi_res = url.replace(url.substring(url.lastIndexOf("_"), url.lastIndexOf(".")), ending);
       URL hi_url = new URL(hi_res);
       File hi_name = Helper.extractMediaFileNameFromURL(hi_url);
       if (hi_name.equals(picture.media_name)) {
         picture.hi_url = hi_url;
         picture.hi_name = hi_name;
         picture.downloaded_hi = true;
         break;
       } else {
         boolean success = Helper.downloadFileFromURLToFileInTemp(hi_url, hi_name);
         if (success) {
           picture.hi_url = hi_url;
           picture.hi_name = hi_name;
           picture.downloaded_hi = true;
           Helper.moveTempImageToStore(hi_name, new File(Main.blogdir, picture.md5_id));
           break;
         }
       }
     } catch (MalformedURLException ex) {
       Main.error(String.format("Attempted hi res url %s is a malformed URL.", hi_res));
     }
   }
 }
  public void TestNBModel(
      Map<Integer, FilewithClassInfo> filesToTest,
      double[] priors,
      Map<Integer, Map<String, Double>> condProb) {
    // TODO Auto-generated method stub
    int percentageAccuracyCounter = 0;
    int percentageErrorCounter = 0;
    Helper h = new Helper();

    for (int i = 0; i < filesToTest.size(); i++) {
      List<Double> vals = new ArrayList<Double>();
      for (int j = 0; j < 2; j++) {
        Map<String, Double> probMap = condProb.get(j);
        double prob = Math.log10(priors[j]);

        for (String token : filesToTest.get(i).WordMap.keySet()) {
          if (probMap.containsKey(token)) prob += Math.log10(probMap.get(token));
        }

        vals.add(prob);
      }

      if (filesToTest.get(i).ClassInfo == h.getMaxValIndex(vals)) percentageAccuracyCounter++;
      else percentageErrorCounter++;
    }

    System.out.println(
        "percentageAccuracyCounter"
            + percentageAccuracyCounter
            + "percentageErrorCounter"
            + percentageErrorCounter);
    System.out.println(
        "Percentage : " + (double) (percentageAccuracyCounter * 100) / filesToTest.size());
  }
  /** Makes sure both minimums and maximums are added */
  @Test
  public void checkMinimumsMaximums() {
    Helper detector = new Helper();
    GeneralToInterestPoint<ImageFloat32, ImageFloat32> alg =
        new GeneralToInterestPoint<ImageFloat32, ImageFloat32>(
            detector, 2.5, ImageFloat32.class, ImageFloat32.class);

    // both turned off
    alg.detect(input);
    assertEquals(0, alg.getNumberOfFeatures());

    // just minimums
    detector.minimum = true;
    alg.detect(input);
    assertEquals(5, alg.getNumberOfFeatures());

    // both minimums and maximums
    detector.maximum = true;
    alg.detect(input);
    assertEquals(11, alg.getNumberOfFeatures());

    // just maximums
    detector.minimum = false;
    alg.detect(input);
    assertEquals(6, alg.getNumberOfFeatures());
  }
  public String doDelete() {

    String back = "", qq = "";

    Connection con = null;
    PreparedStatement pstmt = null;
    ResultSet rs = null;

    con = Helper.getConnection();
    if (con == null) {
      back = "Could not connect to DB";
      addError(back);
      return back;
    } else {
      try {
        qq = "delete from monitors where id=?";
        if (debug) {
          logger.debug(qq);
        }
        pstmt = con.prepareStatement(qq);
        pstmt.setString(1, id);
        pstmt.executeUpdate();
        message = "Deleted Successfully";
      } catch (Exception ex) {
        back += ex + ":" + qq;
        logger.error(back);
        addError(back);
      } finally {
        Helper.databaseDisconnect(con, pstmt, rs);
      }
    }
    return back;
  }
 /*
  * Create a new empty sound
  */
 public ArrayList<Integer> newSound(int soundLength) {
   myHelper = new Helper(soundLength);
   myHelper.setViewer(this);
   data = myHelper.getData();
   createMainFrame();
   return data;
 }
  public String updateStatus(String new_status) {

    String back = "";

    Connection con = null;
    PreparedStatement pstmt = null;
    ResultSet rs = null;
    String str = "";
    String qq = "";
    con = Helper.getConnection();
    if (con == null) {
      back = "Could not connect to DB";
      addError(back);
      return back;
    }
    try {
      qq = "update monitors set status=? where id = ? ";
      if (debug) {
        logger.debug(qq);
      }
      pstmt = con.prepareStatement(qq);
      pstmt.setString(1, new_status);
      pstmt.setString(2, id);
      pstmt.executeUpdate();
    } catch (Exception ex) {
      back += ex + ":" + qq;
      logger.error(back);
      addError(back);
    } finally {
      Helper.databaseDisconnect(con, pstmt, rs);
    }
    return back;
  }
  @Override
  public void evaluate() throws Throwable {
    final FailureExpected failureExpected = extendedFrameworkMethod.getFailureExpectedAnnotation();
    try {
      realInvoker.evaluate();
      // reaching here is expected, unless the test is marked as an expected failure
      if (failureExpected != null) {
        throw new FailureExpectedTestPassedException(extendedFrameworkMethod);
      }
    } catch (FailureExpectedTestPassedException e) {
      // just pass this along
      throw e;
    } catch (Throwable e) {
      // on error handling is very different based on whether the test was marked as an expected
      // failure
      if (failureExpected != null) {

        // handle the expected failure case
        log.infof(
            "Ignoring expected failure [{}] : {}",
            Helper.extractTestName(extendedFrameworkMethod),
            Helper.extractMessage(failureExpected));
        testClassMetadata.performOnExpectedFailureCallback(testInstance);
        // most importantly, do not propagate exception...
      } else {
        // handle the non-expected failure case
        testClassMetadata.performOnFailureCallback(testInstance);
        throw e;
      }
    }
  }
  /*
   * Load a sound given a specific file name
   */
  public ArrayList<Integer> load(String filename) {
    if (filename == null) {
      System.err.println("Please specify a valid file name");
      return null;
    }

    File file = new File(filename);
    if (!file.isFile()) {
      System.err.println("File not found");
      return null;
    }

    String name = file.getName();
    if (!(name.endsWith(".au")
        || name.endsWith(".wav")
        || name.endsWith(".aiff")
        || name.endsWith(".aif"))) {
      System.err.println(
          "Audio format not supported. Please use either files ending with '.au', '.wav', '.aiff', '.aif'");
      return null;
    }

    myHelper = new Helper(file);
    myHelper.setViewer(this);
    createMainFrame();
    data = myHelper.getData();
    return data;
  }
  public static void main(String[] args) {
    MongoClient client = new MongoClient();
    MongoDatabase db = client.getDatabase("course");
    MongoCollection<Document> collection = db.getCollection("deleteTest");

    collection.drop();

    for (int idx = 1; idx <= 8; idx++) {
      collection.insertOne(new Document("_id", idx));
    }

    System.out.println("Before any deletes");
    List<Document> docs = collection.find().into(new ArrayList<Document>());
    for (Document doc : docs) {
      Helper.prettyPrintJSON(doc);
    }

    // delete 2,3,4

    collection.deleteMany(and(gte("_id", 2), lt("_id", 5)));
    System.out.println("removed gte2 lt5");
    docs = collection.find().into(new ArrayList<Document>());
    for (Document doc : docs) {
      Helper.prettyPrintJSON(doc);
    }

    collection.deleteOne(eq("_id", 8));
    System.out.println("Removed id 8");

    docs = collection.find().into(new ArrayList<Document>());
    for (Document doc : docs) {
      Helper.prettyPrintJSON(doc);
    }
  }
  public static void main(String[] args)
      throws IOException, OWLOntologyCreationException, OWLOntologyStorageException {

    // getting the RDF export of the rule's page in SMW
    Scanner scanner =
        new Scanner(
                new URL("http://localhost/mediawiki/index.php/Special:ExportRDF/RudisRule2")
                    .openStream(),
                "UTF-8")
            .useDelimiter("\\A");
    String out = scanner.next();

    Helper.buildBody(out);
    Helper.buildHead(out);

    rule = Helper.body + "->" + Helper.head;
    scanner.close();

    // check
    System.out.println("Rule: " + rule);
    System.out.println("Classes bank: " + Helper.classesBank);
    System.out.println("Vars bank: " + Helper.varsBank);

    GetConceptsFromString_short.fromStringToOWLRDFNotation(rule, basicIRI);
  }
  public void setup() throws Exception {

    setupProperties();

    ReportDefinition rd = createReportDefinition();

    ReportDesign design =
        h.createRowPerPatientXlsOverviewReportDesign(
            rd,
            "ChemotherapyDailyExpectedPatientList.xls",
            "ChemotherapyDailyPatientList.xls_",
            null);

    Properties props = new Properties();
    props.put("repeatingSections", "sheet:1,row:7,dataset:dataSet");
    props.put("sortWeight", "5000");
    design.setProperties(props);

    h.saveReportDesign(design);

    ReportDesign designTwo =
        h.createRowPerPatientXlsOverviewReportDesign(
            rd,
            "ChemotherapyDailyTreatmentSummary.xls",
            "ChemotherapyDailyTreatmentSummary.xls_",
            null);

    Properties propsTwo = new Properties();
    propsTwo.put("repeatingSections", "sheet:1,row:7,dataset:dataSet");
    props.put("sortWeight", "5000");
    designTwo.setProperties(propsTwo);

    h.saveReportDesign(designTwo);
  }
  protected List<FrameworkMethod> doComputation() {
    // Next, get all the test methods as understood by JUnit
    final List<FrameworkMethod> methods = super.computeTestMethods();

    // Now process that full list of test methods and build our custom result
    final List<FrameworkMethod> result = new ArrayList<FrameworkMethod>();
    final boolean doValidation = Boolean.getBoolean(Helper.VALIDATE_FAILURE_EXPECTED);
    int testCount = 0;

    Ignore virtualIgnore;

    for (FrameworkMethod frameworkMethod : methods) {
      // potentially ignore based on expected failure
      final FailureExpected failureExpected =
          Helper.locateAnnotation(FailureExpected.class, frameworkMethod, getTestClass());
      if (failureExpected != null && !doValidation) {
        virtualIgnore =
            new IgnoreImpl(Helper.extractIgnoreMessage(failureExpected, frameworkMethod));
      } else {
        virtualIgnore = convertSkipToIgnore(frameworkMethod);
      }

      testCount++;
      log.trace("adding test " + Helper.extractTestName(frameworkMethod) + " [#" + testCount + "]");
      result.add(new ExtendedFrameworkMethod(frameworkMethod, virtualIgnore, failureExpected));
    }
    return result;
  }
  @Test
  public void testCopyTo() {
    graph = createGraph();
    initExampleGraph(graph);
    GraphStorage gs = newRAMGraph();
    gs.setSegmentSize(8000);
    gs.create(10);
    try {
      graph.copyTo(gs);
      checkExampleGraph(gs);
    } catch (Exception ex) {
      ex.printStackTrace();
      assertTrue(ex.toString(), false);
    }

    try {
      Helper.close((Closeable) graph);
      graph = createGraph();
      gs.copyTo(graph);
      checkExampleGraph(graph);
    } catch (Exception ex) {
      ex.printStackTrace();
      assertTrue(ex.toString(), false);
    }
    Helper.close((Closeable) graph);
  }
Exemple #20
0
  @Start
  public void start() {
    Log.debug("Start WSChan");
    clients = new HashMap<>();
    if (path == null) {
      path = "";
    }

    ContainerRoot model = modelService.getPendingModel();
    if (model == null) {
      model = modelService.getCurrentModel().getModel();
    }
    Channel thisChan = (Channel) model.findByPath(context.getPath());
    Set<String> inputPaths = Helper.getProvidedPortsPath(thisChan, context.getNodeName());
    Set<String> outputPaths = Helper.getRequiredPortsPath(thisChan, context.getNodeName());

    for (String path : inputPaths) {
      // create input WSMsgBroker clients
      createInputClient(path + "_" + context.getInstanceName());
    }

    for (String path : outputPaths) {
      // create output WSMsgBroker clients
      createOutputClient(path + "_" + context.getInstanceName());
    }
  }
  @Test
  public void testCopy() {
    Graph g = initUnsorted(createGraph());
    EdgeIteratorState eb = g.edge(6, 5, 11, true);
    eb.setWayGeometry(Helper.createPointList(12, 10, -1, 3));
    LevelGraph lg = new GraphBuilder(encodingManager).levelGraphCreate();
    GHUtility.copyTo(g, lg);
    eb = lg.getEdgeProps(eb.getEdge(), 6);
    assertEquals(Helper.createPointList(-1, 3, 12, 10), eb.getWayGeometry());
    assertEquals(0, lg.getLevel(0));
    assertEquals(0, lg.getLevel(1));
    assertEquals(0, lg.getLatitude(0), 1e-6);
    assertEquals(1, lg.getLongitude(0), 1e-6);
    assertEquals(2.5, lg.getLatitude(1), 1e-6);
    assertEquals(4.5, lg.getLongitude(1), 1e-6);
    assertEquals(9, lg.getNodes());
    EdgeIterator iter = lg.createEdgeExplorer().setBaseNode(8);
    iter.next();
    assertEquals(2.05, iter.getDistance(), 1e-6);
    assertEquals("11", BitUtil.toBitString(iter.getFlags(), 2));
    iter.next();
    assertEquals(0.5, iter.getDistance(), 1e-6);
    assertEquals("11", BitUtil.toBitString(iter.getFlags(), 2));

    iter = lg.createEdgeExplorer().setBaseNode(7);
    iter.next();
    assertEquals(2.1, iter.getDistance(), 1e-6);
    assertEquals("01", BitUtil.toBitString(iter.getFlags(), 2));
    assertTrue(iter.next());
    assertEquals(0.7, iter.getDistance(), 1e-6);
  }
Exemple #22
0
 private void updateCacheFromLdap()
     throws ChaiUnavailableException, ChaiOperationException, PwmOperationalException,
         PwmUnrecoverableException {
   LOGGER.debug(
       PwmConstants.REPORTING_SESSION_LABEL,
       "beginning process to updating user cache records from ldap");
   if (status != STATUS.OPEN) {
     return;
   }
   cancelFlag = false;
   reportStatus = new ReportStatusInfo(settings.getSettingsHash());
   reportStatus.setInProgress(true);
   reportStatus.setStartDate(new Date());
   try {
     final Queue<UserIdentity> allUsers = new LinkedList<>(getListOfUsers());
     reportStatus.setTotal(allUsers.size());
     while (status == STATUS.OPEN && !allUsers.isEmpty() && !cancelFlag) {
       final Date startUpdateTime = new Date();
       final UserIdentity userIdentity = allUsers.poll();
       try {
         if (updateCachedRecordFromLdap(userIdentity)) {
           reportStatus.setUpdated(reportStatus.getUpdated() + 1);
         }
       } catch (Exception e) {
         String errorMsg =
             "error while updating report cache for " + userIdentity.toString() + ", cause: ";
         errorMsg +=
             e instanceof PwmException
                 ? ((PwmException) e).getErrorInformation().toDebugStr()
                 : e.getMessage();
         final ErrorInformation errorInformation;
         errorInformation = new ErrorInformation(PwmError.ERROR_REPORTING_ERROR, errorMsg);
         LOGGER.error(PwmConstants.REPORTING_SESSION_LABEL, errorInformation.toDebugStr());
         reportStatus.setLastError(errorInformation);
         reportStatus.setErrors(reportStatus.getErrors() + 1);
       }
       reportStatus.setCount(reportStatus.getCount() + 1);
       reportStatus.getEventRateMeter().markEvents(1);
       final TimeDuration totalUpdateTime = TimeDuration.fromCurrent(startUpdateTime);
       if (settings.isAutoCalcRest()) {
         avgTracker.addSample(totalUpdateTime.getTotalMilliseconds());
         Helper.pause(avgTracker.avgAsLong());
       } else {
         Helper.pause(settings.getRestTime().getTotalMilliseconds());
       }
     }
     if (cancelFlag) {
       reportStatus.setLastError(
           new ErrorInformation(
               PwmError.ERROR_SERVICE_NOT_AVAILABLE, "report cancelled by operator"));
     }
   } finally {
     reportStatus.setFinishDate(new Date());
     reportStatus.setInProgress(false);
   }
   LOGGER.debug(
       PwmConstants.REPORTING_SESSION_LABEL,
       "update user cache process completed: " + JsonUtil.serialize(reportStatus));
 }
 /**
  * Test method for {@link
  * tuwien.auto.calimero.dptxlator.DPTXlator2ByteUnsigned#setValue(java.lang.String)}.
  *
  * @throws KNXFormatException
  */
 public final void testSetValueString() throws KNXFormatException {
   t.setValue(value1);
   Helper.assertSimilar(value1, t.getValue());
   final String s = t.getValue();
   t.setValue(s);
   Helper.assertSimilar(value1, t.getValue());
   assertEquals(s, t.getValue());
 }
Exemple #24
0
 protected static void reset() {
   Helper.removeDirectoryIfItExists(Helper.temp);
   Helper.removeDirectoryIfItExists(blogdir);
   Main.post_post_hash.clear();
   Main.pic_pic_hash.clear();
   Main.pic_post_hash.clear();
   Main.dup_post_list.clear();
 }
    private void addView(ViewGroup target, Drawable drawable) {
      Helper.setBackground(blurredView, drawable);
      target.addView(blurredView);

      if (animate) {
        Helper.animate(blurredView, duration);
      }
    }
  @Test
  public void testCommentsEquals() throws Exception {

    CompilationUnit cu1 = Helper.parserString(source_with_comment);
    CompilationUnit cu2 = Helper.parserString(source_with_comment);

    assertEqualsAndHashCode(cu1, cu2);
  }
  public String doSelect() {

    String back = "";

    Connection con = null;
    PreparedStatement pstmt = null;
    ResultSet rs = null;
    String qq =
        "select external_id,device_id,name,asset_num,"
            + " serial_num,screen_size,model,type,"
            + "vertical_resolution,horizontal_resolution,"
            + "manufacturer,"
            + "date_format(received,'%m/%d/%Y'),"
            + "expected_age,status,notes,editable "
            + " from monitors where id=?";
    con = Helper.getConnection();
    if (con == null) {
      back = "Could not connect to DB";
      addError(back);
      return back;
    } else {
      try {
        if (debug) {
          logger.debug(qq);
        }
        pstmt = con.prepareStatement(qq);
        pstmt.setString(1, id);
        rs = pstmt.executeQuery();
        if (rs.next()) {
          setExternal_id(rs.getString(1));
          setDevice_id(rs.getString(2));
          setName(rs.getString(3));
          setAsset_num(rs.getString(4));
          setSerial_num(rs.getString(5));
          setScreen_size(rs.getString(6));
          setModel(rs.getString(7));
          setType(rs.getString(8));
          setVertical_resolution(rs.getString(9));
          setHorizontal_resolution(rs.getString(10));
          setManufacturer(rs.getString(11));
          setReceived(rs.getString(12));
          setExpected_age(rs.getString(13));
          setStatus(rs.getString(14));
          setNotes(rs.getString(15));
          setEditable(rs.getString(16));
        } else {
          return "Record " + id + " Not found";
        }
      } catch (Exception ex) {
        back += ex + ":" + qq;
        logger.error(back);
        addError(back);
      } finally {
        Helper.databaseDisconnect(con, pstmt, rs);
      }
    }
    return back;
  }
 /**
  * Accuracy test for method <code>createConnection</code>.
  *
  * <p>Verifies that the <code>Connection</code> could be returned if the connection name is not
  * provided.
  *
  * @throws Exception if there is any problem.
  */
 public void testCreateConnectionWithNullConnectionName() throws Exception {
   Connection conn = null;
   try {
     conn = Helper.createConnection(factory, null);
     assertNotNull("Fails to create connection.", conn);
   } finally {
     Helper.closeConnection(conn);
   }
 }
  @Test
  public void testCommentsDiff() throws Exception {

    CompilationUnit cu1 = Helper.parserString(source_with_comment);
    CompilationUnit cu2 = Helper.parserString(source_without_comment);

    // hashcode can be the same, equals() shall return false
    assertNotEquals(cu1, cu2);
  }
  @Test
  public void tesCompilationUnitNotEqual() throws Exception {
    String source = Helper.readClass("DumperTestClass");
    CompilationUnit cu1 = Helper.parserString(source);
    CompilationUnit cu2 = Helper.parserString(source);

    cu2.setPackage(new PackageDeclaration(new NameExpr("diff_package")));
    assertNotEqualsAndHashCode(cu1, cu2);
  }