Skip to content

Commit

Permalink
Fixes #8 Generate BDD Assertions entry point file
Browse files Browse the repository at this point in the history
  • Loading branch information
joel-costigliola committed May 9, 2014
1 parent 5f34e1c commit 850c28b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
Expand Up @@ -57,6 +57,8 @@ public AssertionsGeneratorReport generateAssertionsFor(String[] packages, String
report.setAssertionsEntryPointFile(standardAssertionsEntryPointFile);
File softAssertionsEntryPointFile = generator.generateSoftAssertionsEntryPointClassFor(classDescriptions);
report.setSoftAssertionsEntryPointFile(softAssertionsEntryPointFile);
File bddAssertionsEntryPointFile = generator.generateBddAssertionsEntryPointFor(classDescriptions);
report.setBddAssertionsEntryPointFile(bddAssertionsEntryPointFile);
} catch (Exception e) {
report.setException(e);
}
Expand Down
Expand Up @@ -18,6 +18,7 @@ public class AssertionsGeneratorReport {
private List<String> generatedCustomAssertionFileNames;
private File assertionsEntryPointFile;
private File softAssertionsEntryPointFile;
private File bddAssertionsEntryPointFile;
private String[] inputPackages;
private String[] inputClasses;
private Exception exception;
Expand Down Expand Up @@ -72,6 +73,9 @@ private void buildGeneratorReportSuccess(StringBuilder reportBuilder) {
reportBuilder.append("\n");
reportBuilder.append("Soft Assertions entry point class has been generated in file:\n");
reportBuilder.append(INDENT).append(softAssertionsEntryPointFile.getAbsolutePath()).append("\n");
reportBuilder.append("\n");
reportBuilder.append("BDD Assertions entry point class has been generated in file:\n");
reportBuilder.append(INDENT).append(bddAssertionsEntryPointFile.getAbsolutePath()).append("\n");
}

/**
Expand Down Expand Up @@ -161,4 +165,7 @@ public void setException(Exception exception) {
this.exception = exception;
}

public void setBddAssertionsEntryPointFile(final File bddAssertionsEntryPointFile) {
this.bddAssertionsEntryPointFile = bddAssertionsEntryPointFile;
}
}
Expand Up @@ -55,7 +55,9 @@ public void executing_plugin_with_classes_and_packages_parameter_only_should_pas
// check that expected assertions file exist (we don't check the content we suppose the generator works).
assertThat(assertionsFileFor(Employee.class)).exists();
assertThat(assertionsFileFor(Address.class)).exists();
assertThat(assertionsEntryPointFile()).exists();
assertThat(assertionsEntryPointFile("Assertions.java")).exists();
assertThat(assertionsEntryPointFile("BddAssertions.java")).exists();
assertThat(assertionsEntryPointFile("SoftAssertions.java")).exists();
}

@Test
Expand All @@ -68,7 +70,9 @@ public void executing_plugin_with_classes_parameter_only_should_pass() throws Ex

// check that expected assertions file exist (we don't check the content we suppose the generator works).
assertThat(assertionsFileFor(Employee.class)).exists();
assertThat(assertionsEntryPointFile()).exists();
assertThat(assertionsEntryPointFile("Assertions.java")).exists();
assertThat(assertionsEntryPointFile("BddAssertions.java")).exists();
assertThat(assertionsEntryPointFile("SoftAssertions.java")).exists();
}

@Test
Expand Down Expand Up @@ -115,8 +119,8 @@ private static String basePathName(Class<?> clazz) {
return clazz.getPackage().getName().replace('.', File.separatorChar) + File.separator + clazz.getSimpleName();
}

private File assertionsEntryPointFile() throws IOException {
private File assertionsEntryPointFile(String simpleName) throws IOException {
return temporaryFolder.newFile("org.assertj.maven.test".replace('.', File.separatorChar) + File.separator
+ "Assertions.java");
+ simpleName);
}
}

2 comments on commit 850c28b

@Kwaq
Copy link

@Kwaq Kwaq commented on 850c28b May 15, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi,

When can we expect release of this change?

@joel-costigliola
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

by the end of the month or start of June

Please sign in to comment.