Remove System.out.println from tests

This commit is contained in:
Mahmoud Ben Hassine
2023-06-07 15:14:27 +02:00
parent 12b412f60a
commit 98c426ca4f
15 changed files with 17 additions and 41 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2022 the original author or authors.
* Copyright 2022-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -62,7 +62,6 @@ class InlineDataSourceDefinitionTests {
public Job job(JobRepository jobRepository, PlatformTransactionManager transactionManager) {
return new JobBuilder("job", jobRepository)
.start(new StepBuilder("step", jobRepository).tasklet((contribution, chunkContext) -> {
System.out.println("hello world");
return RepeatStatus.FINISHED;
}, transactionManager).build())
.build();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2022 the original author or authors.
* Copyright 2022-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -132,7 +132,6 @@ class DefaultBatchConfigurationTests {
@Bean
public Step myStep(JobRepository jobRepository, PlatformTransactionManager transactionManager) {
Tasklet myTasklet = (contribution, chunkContext) -> {
System.out.println("Hello world");
return RepeatStatus.FINISHED;
};
return new StepBuilder("myStep", jobRepository).tasklet(myTasklet, transactionManager).build();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2013 the original author or authors.
* Copyright 2006-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,6 +22,7 @@ import org.springframework.beans.factory.BeanNameAware;
/**
* @author Dan Garrette
* @author Mahmoud Ben Hassine
* @since 2.0.1
*/
public class DummyStep implements Step, BeanNameAware {
@@ -40,7 +41,6 @@ public class DummyStep implements Step, BeanNameAware {
@Override
public void execute(StepExecution stepExecution) throws JobInterruptedException {
System.out.println("EXECUTING " + getName());
}
@Override

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2022 the original author or authors.
* Copyright 2006-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -57,7 +57,6 @@ class SimpleJvmExitCodeMapperTests {
@Test
void testGetExitCodeWithPredefinedCodesOverridden() {
System.out.println(ecm2.intValue(ExitStatus.COMPLETED.getExitCode()));
assertEquals(ecm2.intValue(ExitStatus.COMPLETED.getExitCode()), -1);
assertEquals(ecm2.intValue(ExitStatus.FAILED.getExitCode()), -2);
assertEquals(ecm2.intValue(ExitCodeMapper.JOB_NOT_PROVIDED), -3);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2015-2022 the original author or authors.
* Copyright 2015-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -196,11 +196,6 @@ class ItemListenerErrorTests {
if (goingToFail) {
throw new RuntimeException("failure in the writer");
}
else {
for (String item : items) {
System.out.println(item);
}
}
}
public void setGoingToFail(boolean goingToFail) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2019-2022 the original author or authors.
* Copyright 2019-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -261,7 +261,8 @@ class BatchMetricsTests {
public Step step2(JobRepository jobRepository, PlatformTransactionManager transactionManager) {
return new StepBuilder("step2", jobRepository).<Integer, Integer>chunk(2, transactionManager)
.reader(new ListItemReader<>(Arrays.asList(1, 2, 3, 4, 5)))
.writer(items -> items.forEach(System.out::println))
.writer(items -> {
})
.build();
}
@@ -269,7 +270,8 @@ class BatchMetricsTests {
public Step step3(JobRepository jobRepository, PlatformTransactionManager transactionManager) {
return new StepBuilder("step3", jobRepository).<Integer, Integer>chunk(2, transactionManager)
.reader(new ListItemReader<>(Arrays.asList(6, 7, 8, 9, 10)))
.writer(items -> items.forEach(System.out::println))
.writer(items -> {
})
.faultTolerant()
.skip(Exception.class)
.skipLimit(3)

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2022 the original author or authors.
* Copyright 2014-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -110,9 +110,6 @@ class OptimisticLockingFailureTests {
@Override
public void write(Chunk<? extends String> items) throws Exception {
for (String item : items) {
System.out.println(item);
}
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2022 the original author or authors.
* Copyright 2014-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -68,8 +68,6 @@ public class ReprocessExceptionTests {
final Person transformedPerson = new Person(firstName, lastName);
System.out.println("Converting (" + person + ") into (" + transformedPerson + ")");
return transformedPerson;
}
@@ -80,7 +78,6 @@ public class ReprocessExceptionTests {
@Override
public void write(Chunk<? extends Person> persons) throws Exception {
for (Person person : persons) {
System.out.println(person.getFirstName() + " " + person.getLastName());
if (person.getFirstName().equals("JANE")) {
throw new RuntimeException("jane doe write exception causing rollback");
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2008-2022 the original author or authors.
* Copyright 2008-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -176,7 +176,6 @@ class SystemCommandTaskletIntegrationTests {
stepExecution.setTerminateOnly();
Exception exception = assertThrows(JobInterruptedException.class, () -> tasklet.execute(null, null));
String message = exception.getMessage();
System.out.println(message);
assertTrue(message.contains("Job interrupted while executing system command"));
assertTrue(message.contains(command[0]));
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2013-2019 the original author or authors.
* Copyright 2013-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -25,7 +25,6 @@ public class TaskletSupport implements Tasklet {
@Nullable
@Override
public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) throws Exception {
System.out.println("The tasklet was executed");
return RepeatStatus.FINISHED;
}

View File

@@ -125,7 +125,6 @@ class ConcurrentTransactionTests {
@Nullable
@Override
public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) throws Exception {
System.out.println(">> Beginning concurrent job test");
return RepeatStatus.FINISHED;
}
}, transactionManager).build();
@@ -137,7 +136,6 @@ class ConcurrentTransactionTests {
@Nullable
@Override
public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) throws Exception {
System.out.println(">> Ending concurrent job test");
return RepeatStatus.FINISHED;
}
}, transactionManager).build();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2022 the original author or authors.
* Copyright 2006-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -84,7 +84,6 @@ abstract class AbstractTradeBatchTests {
@Override
public synchronized void write(Chunk<? extends Trade> data) {
count++;
System.out.println("Executing trade '" + data + "'");
}
}

View File

@@ -242,7 +242,6 @@ class RemoteChunkingManagerStepBuilderTests {
when(retryListener.open(any(), any())).thenReturn(true);
ItemProcessor<String, String> itemProcessor = item -> {
System.out.println("processing item " + item);
if (item.equals("b")) {
throw new Exception("b was found");
}
@@ -260,7 +259,6 @@ class RemoteChunkingManagerStepBuilderTests {
@Nullable
@Override
public String read() throws Exception {
System.out.println(">> count == " + count);
if (count == 6) {
count++;
throw new IOException("6th item");
@@ -271,7 +269,6 @@ class RemoteChunkingManagerStepBuilderTests {
}
else if (count < items.size()) {
String item = items.get(count++);
System.out.println(">> item read was " + item);
return item;
}
else {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2008-2022 the original author or authors.
* Copyright 2008-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -106,7 +106,6 @@ class TransactionalPollingIntegrationTests implements ApplicationContextAware {
assertEquals(expected, processed);
}
catch (Throwable t) {
System.out.println(t.getMessage());
t.printStackTrace();
}
}

View File

@@ -80,9 +80,6 @@ class StepScopeAnnotatedListenerIntegrationTests {
@AfterStep
public ExitStatus exploitState(StepExecution stepExecution) {
System.out.println("******************************");
System.out.println(" READING RESULTS : " + list.size());
return stepExecution.getExitStatus();
}