Merge pull request #4971 from dkapil/task/BAEL-8219

BAEL-8219 Fix tests for core-java, maven and core-java-io projects
This commit is contained in:
Loredana Crusoveanu 2018-08-15 21:54:43 +03:00 committed by GitHub
commit 7866e3e5e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 158 additions and 143 deletions

View File

@ -18,7 +18,7 @@ public class FilenameFilterManualTest {
@BeforeClass
public static void setupClass() {
directory = new File(FilenameFilterManualTest.class.getClassLoader()
.getResource("testFolder")
.getResource("fileNameFilterManualTestFolder")
.getFile());
}

View File

@ -25,11 +25,7 @@ public class Exceptions {
}
public List<Player> loadAllPlayers(String playersFile) throws IOException{
try {
throw new IOException();
} catch(IOException ex) {
throw new IllegalStateException();
}
}
public int getPlayerScoreThrows(String playerFile) throws FileNotFoundException {
@ -163,14 +159,8 @@ public class Exceptions {
}
}
public void throwAsGotoAntiPattern() {
try {
// bunch of code
public void throwAsGotoAntiPattern() throws MyException {
throw new MyException();
// second bunch of code
} catch ( MyException e ) {
// third bunch of code
}
}
public int getPlayerScoreSwallowingExceptionAntiPattern(String playerFile) {

View File

@ -16,8 +16,11 @@ import org.slf4j.LoggerFactory;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import java.util.List;
/**
* Created by madhumita.g on 01-08-2018.
*/
@ -66,20 +69,18 @@ public class AnimalUnitTest {
int testValue = 3;
animal.makeNoise(testValue);
verify(mockAppender).doAppend(captorLoggingEvent.capture());
verify(mockAppender,times(3)).doAppend(captorLoggingEvent.capture());
final LoggingEvent loggingEvent = captorLoggingEvent.getValue();
final List<LoggingEvent> loggingEvents = captorLoggingEvent.getAllValues();
while (testValue != 0) {
for(LoggingEvent loggingEvent : loggingEvents)
{
assertThat(loggingEvent.getLevel(), is(Level.INFO));
assertThat(loggingEvent.getFormattedMessage(),
is("generic animal noise countdown 3\n"
+ "generic animal noise countdown 2\n"
+ "generic animal noise countdown 1\n"));
testValue-=1;
is("generic animal noise countdown "+testValue));
testValue--;
}
}

View File

@ -115,6 +115,30 @@
</plugins>
</build>
<profiles>
<profile>
<id>default</id>
<build>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire-plugin.version}</version>
<configuration>
<excludes>
<exclude>DataTest.java</exclude>
</excludes>
<includes>
<include>TestFail.java</include>
<include>DataCheck.java</include>
</includes>
<testFailureIgnore>true</testFailureIgnore>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<properties>
<maven.resources.version>3.0.2</maven.resources.version>
<maven.failsafe.version>2.21.0</maven.failsafe.version>