Skip to content

Commit f816929

Browse files
committed
Minor tweaks to improve consistency
See #294
1 parent 74c622a commit f816929

File tree

3 files changed

+13
-9
lines changed

3 files changed

+13
-9
lines changed

metafacture-flowcontrol/src/main/java/org/metafacture/flowcontrol/ObjectPipeDecoupler.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2013, 2014 Deutsche Nationalbibliothek
2+
* Copyright 2013-2019 Deutsche Nationalbibliothek and others
33
*
44
* Licensed under the Apache License, Version 2.0 the "License";
55
* you may not use this file except in compliance with the License.
@@ -33,6 +33,7 @@
3333
* @param <T> Object type
3434
*
3535
* @author Markus Micheal Geipel
36+
* @author Pascal Christoph (dr0i)
3637
*/
3738
@In(Object.class)
3839
@Out(Object.class)

metafacture-flowcontrol/src/main/java/org/metafacture/flowcontrol/ObjectThreader.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright 2019 hbz, Pascal Christoph.
1+
/* Copyright 2019 Pascal Christoph, hbz.
22
*
33
* Licensed under the Apache License, Version 2.0 the "License";
44
* you may not use this file except in compliance with the License.
@@ -34,12 +34,12 @@
3434
*
3535
* @param <T> Object type
3636
*
37-
* @author Pascal Christoph(dr0i)
37+
* @author Pascal Christoph (dr0i)
3838
*
3939
*/
4040
@In(Object.class)
4141
@Out(Object.class)
42-
@Description("incoming objects are distributed to the added receivers, running in their own threads")
42+
@Description("Incoming objects are distributed to the added receivers, running in their own threads.")
4343
@FluxCommand("thread-object-tee")
4444
public class ObjectThreader<T> extends DefaultTee<ObjectReceiver<T>> implements ObjectPipe<T, ObjectReceiver<T>> {
4545

@@ -49,10 +49,11 @@ public class ObjectThreader<T> extends DefaultTee<ObjectReceiver<T>> implements
4949
@Override
5050
public void process(final T obj) {
5151
getReceivers().get(objectNumber).process(obj);
52-
if (objectNumber == getReceivers().size() - 1)
52+
if (objectNumber == getReceivers().size() - 1) {
5353
objectNumber = 0;
54-
else
54+
} else {
5555
objectNumber++;
56+
}
5657
}
5758

5859
@Override

metafacture-flowcontrol/src/test/java/org/metafacture/flowcontrol/ObjectThreaderTest.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2019 hbz
2+
* Copyright 2019 Pascal Christoph, hbz.
33
*
44
* Licensed under the Apache License, Version 2.0 the "License";
55
* you may not use this file except in compliance with the License.
@@ -15,6 +15,8 @@
1515
*/
1616
package org.metafacture.flowcontrol;
1717

18+
import static org.assertj.core.api.Assertions.assertThat;
19+
1820
import static org.mockito.Mockito.verify;
1921
import static org.mockito.Mockito.atMost;
2022
import static org.mockito.Mockito.atLeast;
@@ -31,7 +33,7 @@
3133
* Tests for class {@link ObjectThreader} (which itself uses
3234
* {@link org.metafacture.flowcontrol.ObjectPipeDecoupler} to thread receivers).
3335
*
34-
* @author Pascal Christoph(dr0i)
36+
* @author Pascal Christoph (dr0i)
3537
*
3638
*/
3739
public final class ObjectThreaderTest {
@@ -59,7 +61,7 @@ public void shouldSplitAllObjectsToAllThreadedDownStreamReceivers() throws Inter
5961
objectThreader.process("a");
6062
objectThreader.process("c");
6163
// check if two more threads were indeed created
62-
assert (Thread.getAllStackTraces().keySet().size() - ACTIVE_THREADS_AT_BEGINNING == 2);
64+
assertThat(Thread.getAllStackTraces().keySet().size() - ACTIVE_THREADS_AT_BEGINNING).isEqualTo(2);
6365
objectThreader.closeStream();
6466
// verify thread 1
6567
verify(receiverThread1, atLeast(2)).process("a");

0 commit comments

Comments
 (0)