JS backend: add NotNull and Nullable annotations

This commit is contained in:
Michael Nedzelsky
2014-10-02 15:59:51 +04:00
parent 6f1d362917
commit 03f673d6cf
3 changed files with 23 additions and 3 deletions
@@ -39,14 +39,19 @@ public class SimpleTestClassModel implements TestClassModel {
return o1.getName().compareTo(o2.getName());
}
};
@NotNull
private final File rootFile;
private final boolean recursive;
private final boolean excludeParentDirs;
@NotNull
private final Pattern filenamePattern;
@NotNull
private final String doTestMethodName;
@NotNull
private final String testClassName;
@Nullable
private Collection<TestClassModel> innerTestClasses;
@Nullable
private Collection<TestMethodModel> testMethods;
public SimpleTestClassModel(
@@ -27,12 +27,21 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class SimpleTestMethodModel implements TestMethodModel {
@NotNull
private final File rootDir;
@NotNull
private final File file;
@NotNull
private final String doTestMethodName;
@NotNull
private final Pattern filenamePattern;
public SimpleTestMethodModel(File rootDir, File file, String doTestMethodName, Pattern filenamePattern) {
public SimpleTestMethodModel(
@NotNull File rootDir,
@NotNull File file,
@NotNull String doTestMethodName,
@NotNull Pattern filenamePattern
) {
this.rootDir = rootDir;
this.file = file;
this.doTestMethodName = doTestMethodName;
@@ -58,6 +67,7 @@ public class SimpleTestMethodModel implements TestMethodModel {
assert found : file.getName() + " isn't matched by regex " + filenamePattern.pattern();
assert matcher.groupCount() == 1 : filenamePattern.pattern();
String extractedName = matcher.group(1);
assert extractedName != null : "extractedName should not be null: " + filenamePattern.pattern();
String unescapedName;
if (rootDir.equals(file.getParentFile())) {
@@ -34,11 +34,15 @@ import java.util.List;
import java.util.regex.Pattern;
public class SingleClassTestModel implements TestClassModel {
@NotNull
private final File rootFile;
@NotNull
private final Pattern filenamePattern;
@NotNull
private final String doTestMethodName;
@NotNull
private final String testClassName;
@Nullable
private Collection<TestMethodModel> testMethods;
public SingleClassTestModel(
@@ -91,6 +95,7 @@ public class SingleClassTestModel implements TestClassModel {
return testMethods;
}
@NotNull
protected Collection<TestMethodModel> getTestMethodsFromFile(File file) {
return Collections.<TestMethodModel>singletonList(new SimpleTestMethodModel(rootFile, file, doTestMethodName, filenamePattern));
}