Skip to content

Commit

Permalink
Fix all annotation testing issues on Windows (#2721)
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Saveau <[email protected]>
  • Loading branch information
SUPERCILEX authored and sjudd committed Dec 20, 2017
1 parent 650bb77 commit 2b4be8b
Show file tree
Hide file tree
Showing 13 changed files with 94 additions and 57 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.bumptech.glide.annotation.compiler;

import static com.bumptech.glide.annotation.compiler.test.Util.appResource;
import static com.bumptech.glide.annotation.compiler.test.Util.asUnixChars;
import static com.bumptech.glide.annotation.compiler.test.Util.emptyLibraryModule;
import static com.bumptech.glide.annotation.compiler.test.Util.glide;
import static com.bumptech.glide.annotation.compiler.test.Util.subpackage;
Expand Down Expand Up @@ -39,47 +40,49 @@ public void compilation_generatesExpectedGlideOptionsClass() throws IOException
assertThat(compilation)
.generatedSourceFile(subpackage("GlideOptions"))
.contentsAsUtf8String()
.isEqualTo(appResource("GlideOptions.java").getCharContent(true));
.isEqualTo(asUnixChars(appResource("GlideOptions.java").getCharContent(true)));
}

@Test
public void compilation_generatesExpectedGlideRequestClass() throws IOException {
assertThat(compilation)
.generatedSourceFile(subpackage("GlideRequest"))
.contentsAsUtf8String()
.isEqualTo(appResource("GlideRequest.java").getCharContent(true));
.isEqualTo(asUnixChars(appResource("GlideRequest.java").getCharContent(true)));
}

@Test
public void compilation_generatesExpectedGlideRequestsClass() throws IOException {
assertThat(compilation)
.generatedSourceFile(subpackage("GlideRequests"))
.contentsAsUtf8String()
.isEqualTo(appResource("GlideRequests.java").getCharContent(true));
.isEqualTo(asUnixChars(appResource("GlideRequests.java").getCharContent(true)));
}

@Test
public void compilationGeneratesExpectedGlideAppClass() throws IOException {
assertThat(compilation)
.generatedSourceFile(subpackage("GlideApp"))
.contentsAsUtf8String()
.isEqualTo(appResource("GlideApp.java").getCharContent(true));
.isEqualTo(asUnixChars(appResource("GlideApp.java").getCharContent(true)));
}

@Test
public void compilation_generatesExpectedGeneratedAppGlideModuleImpl() throws IOException {
assertThat(compilation)
.generatedSourceFile(glide("GeneratedAppGlideModuleImpl"))
.contentsAsUtf8String()
.isEqualTo(forResource("GeneratedAppGlideModuleImpl.java").getCharContent(true));
.isEqualTo(
asUnixChars(forResource("GeneratedAppGlideModuleImpl.java").getCharContent(true)));
}

@Test
public void compilation_generatesExpectedGeneratedRequestManagerFactory() throws IOException {
assertThat(compilation)
.generatedSourceFile(glide("GeneratedRequestManagerFactory"))
.contentsAsUtf8String()
.isEqualTo(appResource("GeneratedRequestManagerFactory.java").getCharContent(true));
.isEqualTo(
asUnixChars(appResource("GeneratedRequestManagerFactory.java").getCharContent(true)));
}

private JavaFileObject forResource(String name) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.bumptech.glide.annotation.compiler;

import static com.bumptech.glide.annotation.compiler.test.Util.appResource;
import static com.bumptech.glide.annotation.compiler.test.Util.asUnixChars;
import static com.bumptech.glide.annotation.compiler.test.Util.glide;
import static com.bumptech.glide.annotation.compiler.test.Util.subpackage;
import static com.google.testing.compile.CompilationSubject.assertThat;
Expand Down Expand Up @@ -39,47 +40,49 @@ public void compilation_generatesExpectedGlideOptionsClass() throws IOException
assertThat(compilation)
.generatedSourceFile(subpackage("GlideOptions"))
.contentsAsUtf8String()
.isEqualTo(appResource("GlideOptions.java").getCharContent(true));
.isEqualTo(asUnixChars(appResource("GlideOptions.java").getCharContent(true)));
}

@Test
public void compilation_generatesExpectedGlideRequestClass() throws IOException {
assertThat(compilation)
.generatedSourceFile(subpackage("GlideRequest"))
.contentsAsUtf8String()
.isEqualTo(appResource("GlideRequest.java").getCharContent(true));
.isEqualTo(asUnixChars(appResource("GlideRequest.java").getCharContent(true)));
}

@Test
public void compilation_generatesExpectedGlideRequestsClass() throws IOException {
assertThat(compilation)
.generatedSourceFile(subpackage("GlideRequests"))
.contentsAsUtf8String()
.isEqualTo(appResource("GlideRequests.java").getCharContent(true));
.isEqualTo(asUnixChars(appResource("GlideRequests.java").getCharContent(true)));
}

@Test
public void compilationGeneratesExpectedGlideAppClass() throws IOException {
assertThat(compilation)
.generatedSourceFile(subpackage("GlideApp"))
.contentsAsUtf8String()
.isEqualTo(appResource("GlideApp.java").getCharContent(true));
.isEqualTo(asUnixChars(appResource("GlideApp.java").getCharContent(true)));
}

@Test
public void compilation_generatesExpectedGeneratedAppGlideModuleImpl() throws IOException {
assertThat(compilation)
.generatedSourceFile(glide("GeneratedAppGlideModuleImpl"))
.contentsAsUtf8String()
.isEqualTo(forResource("GeneratedAppGlideModuleImpl.java").getCharContent(true));
.isEqualTo(
asUnixChars(forResource("GeneratedAppGlideModuleImpl.java").getCharContent(true)));
}

@Test
public void compilation_generatesExpectedGeneratedRequestManagerFactory() throws IOException {
assertThat(compilation)
.generatedSourceFile(glide("GeneratedRequestManagerFactory"))
.contentsAsUtf8String()
.isEqualTo(appResource("GeneratedRequestManagerFactory.java").getCharContent(true));
.isEqualTo(
asUnixChars(appResource("GeneratedRequestManagerFactory.java").getCharContent(true)));
}

private JavaFileObject forResource(String name) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import static com.bumptech.glide.annotation.compiler.test.Util.annotation;
import static com.bumptech.glide.annotation.compiler.test.Util.appResource;
import static com.bumptech.glide.annotation.compiler.test.Util.asUnixChars;
import static com.bumptech.glide.annotation.compiler.test.Util.emptyAppModule;
import static com.bumptech.glide.annotation.compiler.test.Util.emptyLibraryModule;
import static com.bumptech.glide.annotation.compiler.test.Util.glide;
Expand Down Expand Up @@ -49,47 +50,49 @@ public void compilation_generatesExpectedGlideOptionsClass() throws IOException
assertThat(compilation)
.generatedSourceFile(subpackage("GlideOptions"))
.contentsAsUtf8String()
.isEqualTo(appResource("GlideOptions.java").getCharContent(true));
.isEqualTo(asUnixChars(appResource("GlideOptions.java").getCharContent(true)));
}

@Test
public void compilation_generatesExpectedGlideRequestClass() throws IOException {
assertThat(compilation)
.generatedSourceFile(subpackage("GlideRequest"))
.contentsAsUtf8String()
.isEqualTo(appResource("GlideRequest.java").getCharContent(true));
.isEqualTo(asUnixChars(appResource("GlideRequest.java").getCharContent(true)));
}

@Test
public void compilation_generatesExpectedGlideRequestsClass() throws IOException {
assertThat(compilation)
.generatedSourceFile(subpackage("GlideRequests"))
.contentsAsUtf8String()
.isEqualTo(appResource("GlideRequests.java").getCharContent(true));
.isEqualTo(asUnixChars(appResource("GlideRequests.java").getCharContent(true)));
}

@Test
public void compilationGeneratesExpectedGlideAppClass() throws IOException {
assertThat(compilation)
.generatedSourceFile(subpackage("GlideApp"))
.contentsAsUtf8String()
.isEqualTo(appResource("GlideApp.java").getCharContent(true));
.isEqualTo(asUnixChars(appResource("GlideApp.java").getCharContent(true)));
}

@Test
public void compilation_generatesExpectedGeneratedAppGlideModuleImpl() throws IOException {
assertThat(compilation)
.generatedSourceFile(glide("GeneratedAppGlideModuleImpl"))
.contentsAsUtf8String()
.isEqualTo(forResource("GeneratedAppGlideModuleImpl.java").getCharContent(true));
.isEqualTo(
asUnixChars(forResource("GeneratedAppGlideModuleImpl.java").getCharContent(true)));
}

@Test
public void compilation_generatesExpectedGeneratedRequestManagerFactory() throws IOException {
assertThat(compilation)
.generatedSourceFile(glide("GeneratedRequestManagerFactory"))
.contentsAsUtf8String()
.isEqualTo(appResource("GeneratedRequestManagerFactory.java").getCharContent(true));
.isEqualTo(
asUnixChars(appResource("GeneratedRequestManagerFactory.java").getCharContent(true)));
}

@Test
Expand All @@ -99,7 +102,7 @@ public void compilation_generatesExpectedIndexer() throws IOException {
assertThat(compilation)
.generatedSourceFile(annotation(expectedClassName))
.contentsAsUtf8String()
.isEqualTo(libraryResource(expectedClassName + ".java").getCharContent(true));
.isEqualTo(asUnixChars(libraryResource(expectedClassName + ".java").getCharContent(true)));
}

private JavaFileObject forResource(String name) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.bumptech.glide.annotation.compiler;

import static com.bumptech.glide.annotation.compiler.test.Util.asUnixChars;
import static com.bumptech.glide.annotation.compiler.test.Util.glide;
import static com.bumptech.glide.annotation.compiler.test.Util.subpackage;
import static com.google.testing.compile.CompilationSubject.assertThat;
Expand Down Expand Up @@ -42,47 +43,49 @@ public void compilation_generatesExpectedGlideOptionsClass() throws IOException
assertThat(compilation)
.generatedSourceFile(subpackage("GlideOptions"))
.contentsAsUtf8String()
.isEqualTo(forResource("GlideOptions.java").getCharContent(true));
.isEqualTo(asUnixChars(forResource("GlideOptions.java").getCharContent(true)));
}

@Test
public void compilation_generatesExpectedGlideRequestClass() throws IOException {
assertThat(compilation)
.generatedSourceFile(subpackage("GlideRequest"))
.contentsAsUtf8String()
.isEqualTo(forResource("GlideRequest.java").getCharContent(true));
.isEqualTo(asUnixChars(forResource("GlideRequest.java").getCharContent(true)));
}

@Test
public void compilation_generatesExpectedGlideRequestsClass() throws IOException {
assertThat(compilation)
.generatedSourceFile(subpackage("GlideRequests"))
.contentsAsUtf8String()
.isEqualTo(forResource("GlideRequests.java").getCharContent(true));
.isEqualTo(asUnixChars(forResource("GlideRequests.java").getCharContent(true)));
}

@Test
public void compilationGeneratesExpectedGlideAppClass() throws IOException {
assertThat(compilation)
.generatedSourceFile(subpackage("GlideApp"))
.contentsAsUtf8String()
.isEqualTo(forResource("GlideApp.java").getCharContent(true));
.isEqualTo(asUnixChars(forResource("GlideApp.java").getCharContent(true)));
}

@Test
public void compilation_generatesExpectedGeneratedAppGlideModuleImpl() throws IOException {
assertThat(compilation)
.generatedSourceFile(glide("GeneratedAppGlideModuleImpl"))
.contentsAsUtf8String()
.isEqualTo(forResource("GeneratedAppGlideModuleImpl.java").getCharContent(true));
.isEqualTo(
asUnixChars(forResource("GeneratedAppGlideModuleImpl.java").getCharContent(true)));
}

@Test
public void compilation_generatesExpectedGeneratedRequestManagerFactory() throws IOException {
assertThat(compilation)
.generatedSourceFile(glide("GeneratedRequestManagerFactory"))
.contentsAsUtf8String()
.isEqualTo(forResource("GeneratedRequestManagerFactory.java").getCharContent(true));
.isEqualTo(
asUnixChars(forResource("GeneratedRequestManagerFactory.java").getCharContent(true)));
}

private JavaFileObject forResource(String name) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.bumptech.glide.annotation.compiler;

import static com.bumptech.glide.annotation.compiler.test.Util.annotation;
import static com.bumptech.glide.annotation.compiler.test.Util.asUnixChars;
import static com.google.testing.compile.CompilationSubject.assertThat;
import static com.google.testing.compile.Compiler.javac;

Expand Down Expand Up @@ -43,7 +44,7 @@ public void compilation_generatesExpectedIndexer() throws IOException {
assertThat(compilation)
.generatedSourceFile(annotation(expectedClassName))
.contentsAsUtf8String()
.isEqualTo(forResource(expectedClassName + ".java").getCharContent(true));
.isEqualTo(asUnixChars(forResource(expectedClassName + ".java").getCharContent(true)));
}

private JavaFileObject forResource(String name) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.bumptech.glide.annotation.compiler;

import static com.bumptech.glide.annotation.compiler.test.Util.asUnixChars;
import static com.bumptech.glide.annotation.compiler.test.Util.emptyAppModule;
import static com.bumptech.glide.annotation.compiler.test.Util.subpackage;
import static com.google.testing.compile.CompilationSubject.assertThat;
Expand Down Expand Up @@ -94,7 +95,7 @@ String file() {
}

private void runTest(String subDir, Subject subject) throws IOException {
Compilation compilation =
Compilation compilation =
javac()
.withProcessors(new GlideAnnotationProcessor())
.compile(
Expand All @@ -105,7 +106,7 @@ private void runTest(String subDir, Subject subject) throws IOException {
assertThat(compilation)
.generatedSourceFile(subpackage(subject.name()))
.contentsAsUtf8String()
.isEqualTo(forResource(subDir, subject.file()).getCharContent(true));
.isEqualTo(asUnixChars(forResource(subDir, subject.file()).getCharContent(true)));
}

private JavaFileObject extension(String subdir) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.bumptech.glide.annotation.compiler;

import static com.bumptech.glide.annotation.compiler.test.Util.appResource;
import static com.bumptech.glide.annotation.compiler.test.Util.asUnixChars;
import static com.bumptech.glide.annotation.compiler.test.Util.emptyAppModule;
import static com.bumptech.glide.annotation.compiler.test.Util.glide;
import static com.bumptech.glide.annotation.compiler.test.Util.subpackage;
Expand Down Expand Up @@ -46,47 +47,49 @@ public void compilation_generatesExpectedGlideOptionsClass() throws IOException
assertThat(compilation)
.generatedSourceFile(subpackage("GlideOptions"))
.contentsAsUtf8String()
.isEqualTo(forResource("GlideOptions.java").getCharContent(true));
.isEqualTo(asUnixChars(forResource("GlideOptions.java").getCharContent(true)));
}

@Test
public void compilation_generatesExpectedGlideRequestClass() throws IOException {
assertThat(compilation)
.generatedSourceFile(subpackage("GlideRequest"))
.contentsAsUtf8String()
.isEqualTo(forResource("GlideRequest.java").getCharContent(true));
.isEqualTo(asUnixChars(forResource("GlideRequest.java").getCharContent(true)));
}

@Test
public void compilation_generatesExpectedGlideRequestsClass() throws IOException {
assertThat(compilation)
.generatedSourceFile(subpackage("GlideRequests"))
.contentsAsUtf8String()
.isEqualTo(appResource("GlideRequests.java").getCharContent(true));
.isEqualTo(asUnixChars(appResource("GlideRequests.java").getCharContent(true)));
}

@Test
public void compilationGeneratesExpectedGlideAppClass() throws IOException {
assertThat(compilation)
.generatedSourceFile(subpackage("GlideApp"))
.contentsAsUtf8String()
.isEqualTo(appResource("GlideApp.java").getCharContent(true));
.isEqualTo(asUnixChars(appResource("GlideApp.java").getCharContent(true)));
}

@Test
public void compilation_generatesExpectedGeneratedAppGlideModuleImpl() throws IOException {
assertThat(compilation)
.generatedSourceFile(glide("GeneratedAppGlideModuleImpl"))
.contentsAsUtf8String()
.isEqualTo(appResource("GeneratedAppGlideModuleImpl.java").getCharContent(true));
.isEqualTo(
asUnixChars(appResource("GeneratedAppGlideModuleImpl.java").getCharContent(true)));
}

@Test
public void compilation_generatesExpectedGeneratedRequestManagerFactory() throws IOException {
assertThat(compilation)
.generatedSourceFile(glide("GeneratedRequestManagerFactory"))
.contentsAsUtf8String()
.isEqualTo(appResource("GeneratedRequestManagerFactory.java").getCharContent(true));
.isEqualTo(
asUnixChars(appResource("GeneratedRequestManagerFactory.java").getCharContent(true)));
}

private JavaFileObject forResource(String name) {
Expand Down
Loading

0 comments on commit 2b4be8b

Please sign in to comment.