コード例 #1
0
  @Test
  public void testSingleFileSingleLineEmptyComment() {
    final int bugId = 102716;
    Assert.assertTrue(this.p.hasBug(bugId));
    Assert.assertEquals(1, this.p.getBug(bugId).getFiles().size());

    final File firstFile = this.p.getBug(bugId).getFiles().get(0);
    Assert.assertEquals(1, firstFile.getLines().size());

    final Line firstLine = firstFile.getLines().get(0);
    Assert.assertEquals(1182, firstLine.getLine());
    Assert.assertEquals(Suspiciousness.HIGH, firstLine.getSuspiciousness());
    Assert.assertEquals("", firstLine.getComment());
  }
コード例 #2
0
  @Test
  public void testSingleFileSingleLineMissingSuspiciousness() {
    final int bugId = 102719;
    Assert.assertTrue(this.p.hasBug(bugId));
    Assert.assertEquals(1, this.p.getBug(bugId).getFiles().size());

    final File firstFile = this.p.getBug(bugId).getFiles().get(0);
    Assert.assertEquals(1, firstFile.getLines().size());

    final Line firstLine = firstFile.getLines().get(0);
    Assert.assertEquals(1182, firstLine.getLine());
    Assert.assertEquals(Suspiciousness.UNKNOWN, firstLine.getSuspiciousness());
    Assert.assertEquals("added new else if branch", firstLine.getComment());
  }
コード例 #3
0
  @Test
  public void testSingleFileSingleLineInvalidLineNumber() {
    final int bugId = 102720;
    Assert.assertTrue(this.p.hasBug(bugId));
    Assert.assertEquals(1, this.p.getBug(bugId).getFiles().size());

    final File firstFile = this.p.getBug(bugId).getFiles().get(0);
    Assert.assertEquals(0, firstFile.getLines().size());
  }
コード例 #4
0
  @Test
  public void testMultiFileMultiLine() {
    final int bugId = 102721;
    Assert.assertTrue(this.p.hasBug(bugId));
    final Bug bug = this.p.getBug(bugId);
    Assert.assertEquals(2, bug.getFiles().size());
    Assert.assertTrue(bug.hasFile("org/aspectj/weaver/patterns/PointcutRewriter.java"));
    Assert.assertTrue(
        bug.hasFile(
            "org/aspectj/ajdt/internal/compiler/ast/ValidateAtAspectJAnnotationsVisitor.java"));
    Assert.assertFalse(bug.hasFile("nonexisting.java"));

    final File firstFile = bug.getFile("org/aspectj/weaver/patterns/PointcutRewriter.java");
    Assert.assertEquals(2, firstFile.getLines().size());

    final File secondFile =
        bug.getFile(
            "org/aspectj/ajdt/internal/compiler/ast/ValidateAtAspectJAnnotationsVisitor.java");
    Assert.assertEquals(1, secondFile.getLines().size());
  }