Skip to content

Commit

Permalink
Replace pair parameter with pair of parameters.
Browse files Browse the repository at this point in the history
  • Loading branch information
Evgeny Gerashchenko authored and Evgeny Gerashchenko committed Mar 12, 2013
1 parent c7df5c2 commit cb0b76d
Showing 1 changed file with 16 additions and 15 deletions.
Expand Up @@ -66,7 +66,7 @@ protected void doTest(@NotNull String javaFileName) throws Exception {
Pair<NamespaceDescriptor, BindingContext> javaNamespaceAndContext = compileJavaAndLoadTestNamespaceAndBindingContextFromBinary(
Arrays.asList(javaFile),
tmpdir, myTestRootDisposable, ConfigurationKind.JDK_AND_ANNOTATIONS);
checkLoadedNamespaces(txtFile, kotlinNamespace, javaNamespaceAndContext);
checkLoadedNamespaces(txtFile, kotlinNamespace, javaNamespaceAndContext.first, javaNamespaceAndContext.second);
}

protected void doTestCompiledJava(@NotNull String expectedFileName, @NotNull String... javaFileNames) throws Exception {
Expand All @@ -82,20 +82,20 @@ public File fun(String s) {
File expectedFile = new File(expectedFileName);
File tmpDir = JetTestUtils.tmpDir(expectedFile.getName());

Pair<NamespaceDescriptor, BindingContext> javaNamespaceAndBindingContext
Pair<NamespaceDescriptor, BindingContext> javaNamespaceAndContext
= compileJavaAndLoadTestNamespaceAndBindingContextFromBinary(files, tmpDir, getTestRootDisposable(),
ConfigurationKind.JDK_ONLY);

checkJavaNamespace(expectedFile, javaNamespaceAndBindingContext);
checkJavaNamespace(expectedFile, javaNamespaceAndContext.first, javaNamespaceAndContext.second);
}

protected void doTestSourceJava(@NotNull String expectedFileName, @NotNull String javaRoot) throws Exception {
File expectedFile = new File(expectedFileName);

Pair<NamespaceDescriptor, BindingContext> javaNamespaceAndBindingContext
Pair<NamespaceDescriptor, BindingContext> javaNamespaceAndContext
= loadTestNamespaceAndBindingContextFromJavaRoot(new File(javaRoot), getTestRootDisposable(), ConfigurationKind.JDK_ONLY);

checkJavaNamespace(expectedFile, javaNamespaceAndBindingContext);
checkJavaNamespace(expectedFile, javaNamespaceAndContext.first, javaNamespaceAndContext.second);
}

protected void doTestJavaAgainstKotlin(String path) throws Exception {
Expand Down Expand Up @@ -136,14 +136,13 @@ protected void doTestJavaAgainstKotlin(String path) throws Exception {
}

private static void checkForLoadErrorsAndCompare(
@NotNull Pair<NamespaceDescriptor, BindingContext> javaNamespaceAndContext,
@NotNull NamespaceDescriptor javaNamespace,
@NotNull BindingContext bindingContext,
@NotNull Runnable compareNamespacesRunnable
) {
NamespaceDescriptor javaNamespace = javaNamespaceAndContext.first;

boolean fail = false;
try {
ExpectedLoadErrorsUtil.checkForLoadErrors(javaNamespace, javaNamespaceAndContext.second);
ExpectedLoadErrorsUtil.checkForLoadErrors(javaNamespace, bindingContext);
}
catch (ComparisonFailure e) {
// to let the next check run even if this one failed
Expand All @@ -166,24 +165,26 @@ private static void checkForLoadErrorsAndCompare(
private static void checkLoadedNamespaces(
final File txtFile,
final NamespaceDescriptor kotlinNamespace,
final Pair<NamespaceDescriptor, BindingContext> javaNamespaceAndContext
final NamespaceDescriptor javaNamespace,
BindingContext bindingContext
) {
checkForLoadErrorsAndCompare(javaNamespaceAndContext, new Runnable() {
checkForLoadErrorsAndCompare(javaNamespace, bindingContext, new Runnable() {
@Override
public void run() {
compareNamespaces(kotlinNamespace, javaNamespaceAndContext.first, DONT_INCLUDE_METHODS_OF_OBJECT, txtFile);
compareNamespaces(kotlinNamespace, javaNamespace, DONT_INCLUDE_METHODS_OF_OBJECT, txtFile);
}
});
}

private static void checkJavaNamespace(
final File txtFile,
final Pair<NamespaceDescriptor, BindingContext> javaNamespaceAndContext
final NamespaceDescriptor javaNamespace,
BindingContext bindingContext
) {
checkForLoadErrorsAndCompare(javaNamespaceAndContext, new Runnable() {
checkForLoadErrorsAndCompare(javaNamespace, bindingContext, new Runnable() {
@Override
public void run() {
compareNamespaceWithFile(javaNamespaceAndContext.first, DONT_INCLUDE_METHODS_OF_OBJECT, txtFile);
compareNamespaceWithFile(javaNamespace, DONT_INCLUDE_METHODS_OF_OBJECT, txtFile);
}
});
}
Expand Down

0 comments on commit cb0b76d

Please sign in to comment.