File tree Expand file tree Collapse file tree 3 files changed +13
-9
lines changed
metafacture-flowcontrol/src
main/java/org/metafacture/flowcontrol
test/java/org/metafacture/flowcontrol Expand file tree Collapse file tree 3 files changed +13
-9
lines changed Original file line number Diff line number Diff line change 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.
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 )
Original file line number Diff line number Diff line change 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.
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" )
4444public 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
Original file line number Diff line number Diff line change 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.
1515 */
1616package org .metafacture .flowcontrol ;
1717
18+ import static org .assertj .core .api .Assertions .assertThat ;
19+
1820import static org .mockito .Mockito .verify ;
1921import static org .mockito .Mockito .atMost ;
2022import static org .mockito .Mockito .atLeast ;
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 */
3739public 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" );
You can’t perform that action at this time.
0 commit comments