Skip to content

Commit

Permalink
JavaDoc. Tidy.
Browse files Browse the repository at this point in the history
Signed-off-by: Alin Dreghiciu <adreghiciu@gmail.com>
  • Loading branch information
adreghiciu committed Aug 24, 2012
1 parent df2f4c3 commit 7b8e1fb
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@
public abstract class NexusMatchers
{

/**
* Log file should not contain any of the common unwanted exceptions: NullPointerException, ClassNotFoundException,
* ClassCastException.
*
* @return matcher. Never null.
*/
@Factory
public static Matcher<File> logHasNoCommonExceptions()
{
Expand All @@ -39,12 +45,22 @@ public static Matcher<File> logHasNoCommonExceptions()
);
}

/**
* Log file has no reference to plugins that failed to activate (all plugins were activated successfully).
*
* @return matcher. Never null.
*/
@Factory
public static Matcher<File> logHasNoFailingPlugins()
{
return InversionMatcher.not( logHasFailingPlugins() );
}

/**
* Log file has a reference to an arbitrary plugin that failed to activate.
*
* @return matcher. Never null.
*/
@Factory
public static LogFileMatcher logHasFailingPlugins()
{
Expand All @@ -53,6 +69,12 @@ public static LogFileMatcher logHasFailingPlugins()
) );
}

/**
* Log file has a reference to a specified plugin that failed to activate.
*
* @param pluginId id of plugin that is supposed to fail to activate in format {@code <groupId>:<artifactId>}
* @return matcher. Never null.
*/
@Factory
public static LogFileMatcher logHasFailingPlugin( final String pluginId )
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,11 @@ public class NexusMatcherTest
@Rule
public TestInfoRule testInfo = new TestInfoRule();

/**
* Verify that if log file to be matched does not exist an {@link AssertionError} is thrown with a proper message.
*/
@Test
public void inexistentLogFile()
throws Exception
{
thrown.expect( AssertionError.class );
thrown.expectMessage( "java.io.FileNotFoundException: File 'nexus.log' does not exist" );
Expand All @@ -49,16 +51,21 @@ public void inexistentLogFile()
);
}

/**
* Verify that a log file that does not contain NPE,CNF,CCE matches.
*/
@Test
public void logFileHasNoCommonExceptions()
throws Exception
{
assertThat(
resolveLogFile(),
NexusMatchers.logHasNoCommonExceptions()
);
}

/**
* Verify that a log file that has all plugins activated successfully matches.
*/
@Test
public void logFileHasNoFailingPlugins()
throws Exception
Expand All @@ -69,6 +76,9 @@ public void logFileHasNoFailingPlugins()
);
}

/**
* Verify that a log file that has failing plugins matches.
*/
@Test
public void logFileHasFailingPlugins()
throws Exception
Expand All @@ -79,6 +89,9 @@ public void logFileHasFailingPlugins()
);
}

/**
* Verify that a log file that has a failing "com.sonatype.nexus.plugin:nexus-outreach-plugin" plugin matches.
*/
@Test
public void logFileHasFailingPlugin()
throws Exception
Expand Down

0 comments on commit 7b8e1fb

Please sign in to comment.