Skip to content

Commit

Permalink
Merge branch 'diridari-master'
Browse files Browse the repository at this point in the history
  • Loading branch information
uhafner committed Dec 11, 2017
2 parents 77f5c29 + 799ce62 commit 39df556
Show file tree
Hide file tree
Showing 5 changed files with 148 additions and 143 deletions.

This file was deleted.

48 changes: 39 additions & 9 deletions src/test/java/edu/hm/hafner/analysis/parser/EclipseParserTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,54 @@

import org.junit.jupiter.api.Test;

import edu.hm.hafner.analysis.AbstractParser;
import edu.hm.hafner.analysis.AbstractParserTest;
import edu.hm.hafner.analysis.Issue;
import edu.hm.hafner.analysis.IssueBuilder;
import edu.hm.hafner.analysis.Issues;
import edu.hm.hafner.analysis.Priority;
import static edu.hm.hafner.analysis.assertj.Assertions.*;
import edu.hm.hafner.analysis.assertj.SoftAssertions;
import static edu.hm.hafner.analysis.assertj.SoftAssertions.*;

/**
* Tests the class {@link EclipseParser}.
*/
class EclipseParserTest extends AbstractEclipseParserTest {
class EclipseParserTest extends AbstractParserTest {
private static final String CATEGORY = new IssueBuilder().build().getCategory();

EclipseParserTest() {
super("eclipse.txt");
}

@Override
protected AbstractParser createParser() {
return new EclipseParser();
}

@Override
protected void assertThatIssuesArePresent(final Issues<Issue> issues, final SoftAssertions softly) {
assertThat(issues).hasSize(8);

Issue annotation = issues.get(0);
softly.assertThat(annotation)
.hasPriority(Priority.NORMAL)
.hasCategory(CATEGORY)
.hasLineStart(3)
.hasLineEnd(3)
.hasMessage(
"The serializable class AttributeException does not declare a static final serialVersionUID field of type long")
.hasFileName("C:/Desenvolvimento/Java/jfg/src/jfg/AttributeException.java");
}

/**
* Parses a warning log with previously undetected warnings.
*
* @see <a href="http://issues.jenkins-ci.org/browse/JENKINS-21377">Issue 21377</a>
*/
@Test
void issue21377() {
Issues<Issue> warnings = createParser().parse(openFile("issue21377.txt"));
Issues<Issue> warnings = parse("issue21377.txt");

assertThat(warnings).hasSize(1);

Expand All @@ -45,7 +75,7 @@ void issue21377() {
*/
@Test
void issue13969() {
Issues<Issue> warnings = createParser().parse(openFile("issue13969.txt"));
Issues<Issue> warnings = parse("issue13969.txt");

assertThat(warnings).hasSize(3);

Expand Down Expand Up @@ -82,7 +112,7 @@ void issue13969() {
*/
@Test
void issue12822() {
Issues<Issue> warnings = createParser().parse(openFile("issue12822.txt"));
Issues<Issue> warnings = parse("issue12822.txt");

assertThat(warnings).hasSize(15);
}
Expand All @@ -94,7 +124,7 @@ void issue12822() {
*/
@Test
void issue6427() {
Issues<Issue> warnings = createParser().parse(openFile("issue6427.txt"));
Issues<Issue> warnings = parse("issue6427.txt");

assertThat(warnings).hasSize(18);
assertSoftly(softly -> {
Expand All @@ -115,9 +145,9 @@ void issue6427() {
*/
@Test
void issue7077() {
Issues<Issue> warnings = createParser().parse(openFile("issue7077.txt"));
Issues<Issue> warnings = parse("issue7077.txt");

assertThat(warnings.size()).isEqualTo(2);
assertThat(warnings).hasSize(2);

assertSoftly(softly -> {
softly.assertThat(warnings.get(0)).hasPriority(Priority.NORMAL)
Expand All @@ -142,9 +172,9 @@ void issue7077() {
*/
@Test
void issue7077all() {
Issues<Issue> sorted = createParser().parse(openFile("issue7077-all.txt"));
Issues<Issue> sorted = parse("issue7077-all.txt");

assertThat(sorted.size()).isEqualTo(45);
assertThat(sorted).hasSize(45);

int number = 0;
for (Issue fileAnnotation : sorted) {
Expand Down
53 changes: 29 additions & 24 deletions src/test/java/edu/hm/hafner/analysis/parser/ErlcParserTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,44 +2,49 @@

import org.junit.jupiter.api.Test;

import edu.hm.hafner.analysis.AbstractParser;
import edu.hm.hafner.analysis.AbstractParserTest;
import edu.hm.hafner.analysis.Issue;
import edu.hm.hafner.analysis.Issues;
import edu.hm.hafner.analysis.Priority;
import edu.hm.hafner.analysis.assertj.SoftAssertions;
import static edu.hm.hafner.analysis.assertj.SoftAssertions.*;
import static org.assertj.core.api.Java6Assertions.*;

/**
* Tests the class {@link ErlcParser}.
*/
public class ErlcParserTest extends ParserTester {
public class ErlcParserTest extends AbstractParserTest {
/**
* Parses a file with two Erlc warnings.
* Creates a new instance of {@link AbstractParserTest}.
*/
@Test
public void testWarningsParser() {
Issues<Issue> issues = new ErlcParser().parse(openFile());

assertThat(issues).hasSize(2);

assertSoftly(softly -> {
softly.assertThat(issues.get(0)).hasPriority(Priority.NORMAL)
.hasCategory("Warning")
.hasLineStart(125)
.hasLineEnd(125)
.hasMessage("variable 'Name' is unused")
.hasFileName("./test.erl");
softly.assertThat(issues.get(1)).hasPriority(Priority.HIGH)
.hasCategory("Error")
.hasLineStart(175)
.hasLineEnd(175)
.hasMessage("record 'Extension' undefined")
.hasFileName("./test2.erl");
});
protected ErlcParserTest() {
super("erlc.txt");
}


@Override
protected void assertThatIssuesArePresent(final Issues<Issue> issues, final SoftAssertions softly) {
softly.assertThat(issues).hasSize(2);

softly.assertThat(issues.get(0)).hasPriority(Priority.NORMAL)
.hasCategory("Warning")
.hasLineStart(125)
.hasLineEnd(125)
.hasMessage("variable 'Name' is unused")
.hasFileName("./test.erl");
softly.assertThat(issues.get(1)).hasPriority(Priority.HIGH)
.hasCategory("Error")
.hasLineStart(175)
.hasLineEnd(175)
.hasMessage("record 'Extension' undefined")
.hasFileName("./test2.erl");

}

@Override
protected String getWarningsFile() {
return "erlc.txt";
protected AbstractParser createParser() {
return new ErlcParser();
}
}

89 changes: 48 additions & 41 deletions src/test/java/edu/hm/hafner/analysis/parser/FlexSDKParserTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,64 +9,71 @@

import org.junit.jupiter.api.Test;

import edu.hm.hafner.analysis.AbstractParser;
import edu.hm.hafner.analysis.AbstractParserTest;
import edu.hm.hafner.analysis.Issue;
import edu.hm.hafner.analysis.Issues;
import edu.hm.hafner.analysis.Priority;
import edu.hm.hafner.analysis.assertj.SoftAssertions;
import static edu.hm.hafner.analysis.assertj.SoftAssertions.*;
import static edu.hm.hafner.analysis.parser.ParserTester.*;
import static org.assertj.core.api.Assertions.*;

/**
* Tests the class {@link FlexSDKParser}.
*/
public class FlexSDKParserTest extends ParserTester {
public class FlexSDKParserTest extends AbstractParserTest {
private static final String CATEGORY = DEFAULT_CATEGORY;

/**
* Parses a file with five warnings.
* Creates a new instance of {@link AbstractParserTest}.
*/
@Test
public void parseDeprecation() {
Issues<Issue> warnings = new FlexSDKParser().parse(openFile());
protected FlexSDKParserTest() {
super("flexsdk.txt");
}


@Override
protected void assertThatIssuesArePresent(final Issues<Issue> issues, final SoftAssertions softly) {
softly.assertThat(issues).hasSize(5);


assertThat(warnings).hasSize(5);
Iterator<Issue> iterator = issues.iterator();
softly.assertThat(iterator.next()).hasPriority(Priority.NORMAL)
.hasCategory(CATEGORY)
.hasLineStart(34)
.hasLineEnd(34)
.hasMessage("class 'FeedStructureHelper' will be scoped to the default namespace: com.company.flex.feed internal. It will not be visible outside of this package.")
.hasFileName("D:/workspaces/flexcompo_trunkdev_nightly/src/flexcompo/uicomponents/ugv_component/src/main/com/company/flex/feed/FeedStructureHelper.as");
softly.assertThat(iterator.next()).hasPriority(Priority.NORMAL)
.hasCategory(CATEGORY)
.hasLineStart(122)
.hasLineEnd(122)
.hasMessage("Duplicate variable definition.")
.hasFileName("D:/workspaces/flexcompo_trunkdev_nightly/src/flexcompo/uicomponents/ugv_component/src/main/com/company/flex/component/chart/lasso/DefaultLassoObjectsHandler.as");
softly.assertThat(iterator.next()).hasPriority(Priority.NORMAL)
.hasCategory(CATEGORY)
.hasLineStart(115)
.hasLineEnd(115)
.hasMessage("return value for function 'cx' has no type declaration.")
.hasFileName("D:/workspaces/flexcompo_trunkdev_nightly/src/flexcompo/samples/ugv_helloExtensibility_flex/src/main/extensibility/wordpress/Tag.as");
softly.assertThat(iterator.next()).hasPriority(Priority.NORMAL)
.hasCategory(CATEGORY)
.hasLineStart(157)
.hasLineEnd(157)
.hasMessage("var 'cacheList' will be scoped to the default namespace: HelloExtensibleWorld: internal. It will not be visible outside of this package.")
.hasFileName("D:/workspaces/flexcompo_trunkdev_nightly/src/flexcompo/samples/ugv_helloExtensibility_flex/src/main/HelloExtensibleWorld.mxml");
softly.assertThat(iterator.next()).hasPriority(Priority.NORMAL)
.hasCategory(CATEGORY)
.hasLineStart(148)
.hasLineEnd(148)
.hasMessage("The CSS type selector 'Book' was not processed, because the type was not used in the application.")
.hasFileName("D:/workspaces/flexcompo_trunkdev_nightly/src/flexcompo/samples/ugv_helloExtensibility_flex/src/main/HelloExtensibleWorld.mxml");

assertSoftly(softly -> {
Iterator<Issue> iterator = warnings.iterator();
softly.assertThat(iterator.next()).hasPriority(Priority.NORMAL)
.hasCategory(CATEGORY)
.hasLineStart(34)
.hasLineEnd(34)
.hasMessage("class 'FeedStructureHelper' will be scoped to the default namespace: com.company.flex.feed internal. It will not be visible outside of this package.")
.hasFileName("D:/workspaces/flexcompo_trunkdev_nightly/src/flexcompo/uicomponents/ugv_component/src/main/com/company/flex/feed/FeedStructureHelper.as");
softly.assertThat(iterator.next()).hasPriority(Priority.NORMAL)
.hasCategory(CATEGORY)
.hasLineStart(122)
.hasLineEnd(122)
.hasMessage("Duplicate variable definition.")
.hasFileName("D:/workspaces/flexcompo_trunkdev_nightly/src/flexcompo/uicomponents/ugv_component/src/main/com/company/flex/component/chart/lasso/DefaultLassoObjectsHandler.as");
softly.assertThat(iterator.next()).hasPriority(Priority.NORMAL)
.hasCategory(CATEGORY)
.hasLineStart(115)
.hasLineEnd(115)
.hasMessage("return value for function 'cx' has no type declaration.")
.hasFileName("D:/workspaces/flexcompo_trunkdev_nightly/src/flexcompo/samples/ugv_helloExtensibility_flex/src/main/extensibility/wordpress/Tag.as");
softly.assertThat(iterator.next()).hasPriority(Priority.NORMAL)
.hasCategory(CATEGORY)
.hasLineStart(157)
.hasLineEnd(157)
.hasMessage("var 'cacheList' will be scoped to the default namespace: HelloExtensibleWorld: internal. It will not be visible outside of this package.")
.hasFileName("D:/workspaces/flexcompo_trunkdev_nightly/src/flexcompo/samples/ugv_helloExtensibility_flex/src/main/HelloExtensibleWorld.mxml");
softly.assertThat(iterator.next()).hasPriority(Priority.NORMAL)
.hasCategory(CATEGORY)
.hasLineStart(148)
.hasLineEnd(148)
.hasMessage("The CSS type selector 'Book' was not processed, because the type was not used in the application.")
.hasFileName("D:/workspaces/flexcompo_trunkdev_nightly/src/flexcompo/samples/ugv_helloExtensibility_flex/src/main/HelloExtensibleWorld.mxml");
});
}

@Override
protected String getWarningsFile() {
return "flexsdk.txt";
protected AbstractParser createParser() {
return new FlexSDKParser();
}
}

0 comments on commit 39df556

Please sign in to comment.