The following issues were found

guava-tests/test/com/google/common/base/FinalizableReferenceQueueClassLoaderUnloadingTest.java
63 issues
Avoid instantiating Integer objects. Call Integer.valueOf() instead.
Performance

Line: 188

                  @Override
    public WeakReference<Object> call() {
      WeakReference<Object> wr =
          new FinalizableWeakReference<Object>(new Integer(23), frq) {
            @Override
            public void finalizeReferent() {
              finalized.release();
            }
          };

            

Reported by PMD.

A method/constructor should not explicitly throw java.lang.Exception
Design

Line: 86

                  }
  }

  private WeakReference<ClassLoader> useFrqInSeparateLoader() throws Exception {
    final ClassLoader myLoader = getClass().getClassLoader();
    URLClassLoader sepLoader = new URLClassLoader(getClassPathUrls(), myLoader.getParent());
    // sepLoader is the loader that we will use to load the parallel FinalizableReferenceQueue (FRQ)
    // and friends, and that we will eventually expect to see garbage-collected. The assumption
    // is that the ClassLoader of this test is a URLClassLoader, and that it loads FRQ itself

            

Reported by PMD.

In J2EE, getClassLoader() might not work as expected. Use Thread.currentThread().getContextClassLoader() instead.
Error

Line: 87

                }

  private WeakReference<ClassLoader> useFrqInSeparateLoader() throws Exception {
    final ClassLoader myLoader = getClass().getClassLoader();
    URLClassLoader sepLoader = new URLClassLoader(getClassPathUrls(), myLoader.getParent());
    // sepLoader is the loader that we will use to load the parallel FinalizableReferenceQueue (FRQ)
    // and friends, and that we will eventually expect to see garbage-collected. The assumption
    // is that the ClassLoader of this test is a URLClassLoader, and that it loads FRQ itself
    // rather than delegating to a parent ClassLoader. If this assumption is violated the test will

            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 87

                }

  private WeakReference<ClassLoader> useFrqInSeparateLoader() throws Exception {
    final ClassLoader myLoader = getClass().getClassLoader();
    URLClassLoader sepLoader = new URLClassLoader(getClassPathUrls(), myLoader.getParent());
    // sepLoader is the loader that we will use to load the parallel FinalizableReferenceQueue (FRQ)
    // and friends, and that we will eventually expect to see garbage-collected. The assumption
    // is that the ClassLoader of this test is a URLClassLoader, and that it loads FRQ itself
    // rather than delegating to a parent ClassLoader. If this assumption is violated the test will

            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 88

              
  private WeakReference<ClassLoader> useFrqInSeparateLoader() throws Exception {
    final ClassLoader myLoader = getClass().getClassLoader();
    URLClassLoader sepLoader = new URLClassLoader(getClassPathUrls(), myLoader.getParent());
    // sepLoader is the loader that we will use to load the parallel FinalizableReferenceQueue (FRQ)
    // and friends, and that we will eventually expect to see garbage-collected. The assumption
    // is that the ClassLoader of this test is a URLClassLoader, and that it loads FRQ itself
    // rather than delegating to a parent ClassLoader. If this assumption is violated the test will
    // fail and will need to be rewritten.

            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 96

                  // fail and will need to be rewritten.

    Class<?> frqC = FinalizableReferenceQueue.class;
    Class<?> sepFrqC = sepLoader.loadClass(frqC.getName());
    assertNotSame(frqC, sepFrqC);
    // Check the assumptions above.

    // FRQ tries to load the Finalizer class (for the reference-collecting thread) in a few ways.
    // If the class is accessible to the system ClassLoader (ClassLoader.getSystemClassLoader())

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 97

              
    Class<?> frqC = FinalizableReferenceQueue.class;
    Class<?> sepFrqC = sepLoader.loadClass(frqC.getName());
    assertNotSame(frqC, sepFrqC);
    // Check the assumptions above.

    // FRQ tries to load the Finalizer class (for the reference-collecting thread) in a few ways.
    // If the class is accessible to the system ClassLoader (ClassLoader.getSystemClassLoader())
    // then FRQ does not bother to load Finalizer.class through a separate ClassLoader. That happens

            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 108

                  // and each test creates its own one of those, so there is no test interference here.
    Class<?> sepFrqSystemLoaderC =
        sepLoader.loadClass(FinalizableReferenceQueue.SystemLoader.class.getName());
    Field disabled = sepFrqSystemLoaderC.getDeclaredField("disabled");
    disabled.setAccessible(true);
    disabled.set(null, true);

    // Now make a parallel FRQ and an associated FinalizableWeakReference to an object, in order to
    // exercise some classes from the parallel ClassLoader.

            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 109

                  Class<?> sepFrqSystemLoaderC =
        sepLoader.loadClass(FinalizableReferenceQueue.SystemLoader.class.getName());
    Field disabled = sepFrqSystemLoaderC.getDeclaredField("disabled");
    disabled.setAccessible(true);
    disabled.set(null, true);

    // Now make a parallel FRQ and an associated FinalizableWeakReference to an object, in order to
    // exercise some classes from the parallel ClassLoader.
    AtomicReference<Object> sepFrqA =

            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 110

                      sepLoader.loadClass(FinalizableReferenceQueue.SystemLoader.class.getName());
    Field disabled = sepFrqSystemLoaderC.getDeclaredField("disabled");
    disabled.setAccessible(true);
    disabled.set(null, true);

    // Now make a parallel FRQ and an associated FinalizableWeakReference to an object, in order to
    // exercise some classes from the parallel ClassLoader.
    AtomicReference<Object> sepFrqA =
        new AtomicReference<Object>(sepFrqC.getDeclaredConstructor().newInstance());

            

Reported by PMD.

android/guava-tests/test/com/google/common/base/FinalizableReferenceQueueClassLoaderUnloadingTest.java
63 issues
Avoid instantiating Integer objects. Call Integer.valueOf() instead.
Performance

Line: 188

                  @Override
    public WeakReference<Object> call() {
      WeakReference<Object> wr =
          new FinalizableWeakReference<Object>(new Integer(23), frq) {
            @Override
            public void finalizeReferent() {
              finalized.release();
            }
          };

            

Reported by PMD.

A method/constructor should not explicitly throw java.lang.Exception
Design

Line: 86

                  }
  }

  private WeakReference<ClassLoader> useFrqInSeparateLoader() throws Exception {
    final ClassLoader myLoader = getClass().getClassLoader();
    URLClassLoader sepLoader = new URLClassLoader(getClassPathUrls(), myLoader.getParent());
    // sepLoader is the loader that we will use to load the parallel FinalizableReferenceQueue (FRQ)
    // and friends, and that we will eventually expect to see garbage-collected. The assumption
    // is that the ClassLoader of this test is a URLClassLoader, and that it loads FRQ itself

            

Reported by PMD.

In J2EE, getClassLoader() might not work as expected. Use Thread.currentThread().getContextClassLoader() instead.
Error

Line: 87

                }

  private WeakReference<ClassLoader> useFrqInSeparateLoader() throws Exception {
    final ClassLoader myLoader = getClass().getClassLoader();
    URLClassLoader sepLoader = new URLClassLoader(getClassPathUrls(), myLoader.getParent());
    // sepLoader is the loader that we will use to load the parallel FinalizableReferenceQueue (FRQ)
    // and friends, and that we will eventually expect to see garbage-collected. The assumption
    // is that the ClassLoader of this test is a URLClassLoader, and that it loads FRQ itself
    // rather than delegating to a parent ClassLoader. If this assumption is violated the test will

            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 87

                }

  private WeakReference<ClassLoader> useFrqInSeparateLoader() throws Exception {
    final ClassLoader myLoader = getClass().getClassLoader();
    URLClassLoader sepLoader = new URLClassLoader(getClassPathUrls(), myLoader.getParent());
    // sepLoader is the loader that we will use to load the parallel FinalizableReferenceQueue (FRQ)
    // and friends, and that we will eventually expect to see garbage-collected. The assumption
    // is that the ClassLoader of this test is a URLClassLoader, and that it loads FRQ itself
    // rather than delegating to a parent ClassLoader. If this assumption is violated the test will

            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 88

              
  private WeakReference<ClassLoader> useFrqInSeparateLoader() throws Exception {
    final ClassLoader myLoader = getClass().getClassLoader();
    URLClassLoader sepLoader = new URLClassLoader(getClassPathUrls(), myLoader.getParent());
    // sepLoader is the loader that we will use to load the parallel FinalizableReferenceQueue (FRQ)
    // and friends, and that we will eventually expect to see garbage-collected. The assumption
    // is that the ClassLoader of this test is a URLClassLoader, and that it loads FRQ itself
    // rather than delegating to a parent ClassLoader. If this assumption is violated the test will
    // fail and will need to be rewritten.

            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 96

                  // fail and will need to be rewritten.

    Class<?> frqC = FinalizableReferenceQueue.class;
    Class<?> sepFrqC = sepLoader.loadClass(frqC.getName());
    assertNotSame(frqC, sepFrqC);
    // Check the assumptions above.

    // FRQ tries to load the Finalizer class (for the reference-collecting thread) in a few ways.
    // If the class is accessible to the system ClassLoader (ClassLoader.getSystemClassLoader())

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 97

              
    Class<?> frqC = FinalizableReferenceQueue.class;
    Class<?> sepFrqC = sepLoader.loadClass(frqC.getName());
    assertNotSame(frqC, sepFrqC);
    // Check the assumptions above.

    // FRQ tries to load the Finalizer class (for the reference-collecting thread) in a few ways.
    // If the class is accessible to the system ClassLoader (ClassLoader.getSystemClassLoader())
    // then FRQ does not bother to load Finalizer.class through a separate ClassLoader. That happens

            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 108

                  // and each test creates its own one of those, so there is no test interference here.
    Class<?> sepFrqSystemLoaderC =
        sepLoader.loadClass(FinalizableReferenceQueue.SystemLoader.class.getName());
    Field disabled = sepFrqSystemLoaderC.getDeclaredField("disabled");
    disabled.setAccessible(true);
    disabled.set(null, true);

    // Now make a parallel FRQ and an associated FinalizableWeakReference to an object, in order to
    // exercise some classes from the parallel ClassLoader.

            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 109

                  Class<?> sepFrqSystemLoaderC =
        sepLoader.loadClass(FinalizableReferenceQueue.SystemLoader.class.getName());
    Field disabled = sepFrqSystemLoaderC.getDeclaredField("disabled");
    disabled.setAccessible(true);
    disabled.set(null, true);

    // Now make a parallel FRQ and an associated FinalizableWeakReference to an object, in order to
    // exercise some classes from the parallel ClassLoader.
    AtomicReference<Object> sepFrqA =

            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 110

                      sepLoader.loadClass(FinalizableReferenceQueue.SystemLoader.class.getName());
    Field disabled = sepFrqSystemLoaderC.getDeclaredField("disabled");
    disabled.setAccessible(true);
    disabled.set(null, true);

    // Now make a parallel FRQ and an associated FinalizableWeakReference to an object, in order to
    // exercise some classes from the parallel ClassLoader.
    AtomicReference<Object> sepFrqA =
        new AtomicReference<Object>(sepFrqC.getDeclaredConstructor().newInstance());

            

Reported by PMD.

android/guava-tests/test/com/google/common/graph/StandardImmutableGraphAdditionalTest.java
63 issues
Unit tests should not contain more than 1 assert(s).
Design

Line: 33

              public class StandardImmutableGraphAdditionalTest {

  @Test
  public void immutableGraph() {
    MutableGraph<String> mutableGraph = GraphBuilder.directed().build();
    mutableGraph.addNode("A");
    ImmutableGraph<String> immutableGraph = ImmutableGraph.copyOf(mutableGraph);

    assertThat(immutableGraph).isNotInstanceOf(MutableValueGraph.class);

            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 34

              
  @Test
  public void immutableGraph() {
    MutableGraph<String> mutableGraph = GraphBuilder.directed().build();
    mutableGraph.addNode("A");
    ImmutableGraph<String> immutableGraph = ImmutableGraph.copyOf(mutableGraph);

    assertThat(immutableGraph).isNotInstanceOf(MutableValueGraph.class);
    assertThat(immutableGraph).isEqualTo(mutableGraph);

            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 35

                @Test
  public void immutableGraph() {
    MutableGraph<String> mutableGraph = GraphBuilder.directed().build();
    mutableGraph.addNode("A");
    ImmutableGraph<String> immutableGraph = ImmutableGraph.copyOf(mutableGraph);

    assertThat(immutableGraph).isNotInstanceOf(MutableValueGraph.class);
    assertThat(immutableGraph).isEqualTo(mutableGraph);


            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 38

                  mutableGraph.addNode("A");
    ImmutableGraph<String> immutableGraph = ImmutableGraph.copyOf(mutableGraph);

    assertThat(immutableGraph).isNotInstanceOf(MutableValueGraph.class);
    assertThat(immutableGraph).isEqualTo(mutableGraph);

    mutableGraph.addNode("B");
    assertThat(immutableGraph).isNotEqualTo(mutableGraph);
  }

            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 39

                  ImmutableGraph<String> immutableGraph = ImmutableGraph.copyOf(mutableGraph);

    assertThat(immutableGraph).isNotInstanceOf(MutableValueGraph.class);
    assertThat(immutableGraph).isEqualTo(mutableGraph);

    mutableGraph.addNode("B");
    assertThat(immutableGraph).isNotEqualTo(mutableGraph);
  }


            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 41

                  assertThat(immutableGraph).isNotInstanceOf(MutableValueGraph.class);
    assertThat(immutableGraph).isEqualTo(mutableGraph);

    mutableGraph.addNode("B");
    assertThat(immutableGraph).isNotEqualTo(mutableGraph);
  }

  @Test
  public void copyOfImmutableGraph_optimized() {

            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 42

                  assertThat(immutableGraph).isEqualTo(mutableGraph);

    mutableGraph.addNode("B");
    assertThat(immutableGraph).isNotEqualTo(mutableGraph);
  }

  @Test
  public void copyOfImmutableGraph_optimized() {
    Graph<String> graph1 = ImmutableGraph.copyOf(GraphBuilder.directed().<String>build());

            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 47

              
  @Test
  public void copyOfImmutableGraph_optimized() {
    Graph<String> graph1 = ImmutableGraph.copyOf(GraphBuilder.directed().<String>build());
    Graph<String> graph2 = ImmutableGraph.copyOf(graph1);

    assertThat(graph2).isSameInstanceAs(graph1);
  }


            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 50

                  Graph<String> graph1 = ImmutableGraph.copyOf(GraphBuilder.directed().<String>build());
    Graph<String> graph2 = ImmutableGraph.copyOf(graph1);

    assertThat(graph2).isSameInstanceAs(graph1);
  }

  @Test
  public void immutableGraphBuilder_appliesGraphBuilderConfig() {
    ImmutableGraph<String> emptyGraph =

            

Reported by PMD.

Unit tests should not contain more than 1 assert(s).
Design

Line: 54

                }

  @Test
  public void immutableGraphBuilder_appliesGraphBuilderConfig() {
    ImmutableGraph<String> emptyGraph =
        GraphBuilder.directed()
            .allowsSelfLoops(true)
            .nodeOrder(ElementOrder.<String>natural())
            .immutable()

            

Reported by PMD.

guava-tests/test/com/google/common/graph/StandardImmutableGraphAdditionalTest.java
63 issues
Unit tests should not contain more than 1 assert(s).
Design

Line: 33

              public class StandardImmutableGraphAdditionalTest {

  @Test
  public void immutableGraph() {
    MutableGraph<String> mutableGraph = GraphBuilder.directed().build();
    mutableGraph.addNode("A");
    ImmutableGraph<String> immutableGraph = ImmutableGraph.copyOf(mutableGraph);

    assertThat(immutableGraph).isNotInstanceOf(MutableValueGraph.class);

            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 34

              
  @Test
  public void immutableGraph() {
    MutableGraph<String> mutableGraph = GraphBuilder.directed().build();
    mutableGraph.addNode("A");
    ImmutableGraph<String> immutableGraph = ImmutableGraph.copyOf(mutableGraph);

    assertThat(immutableGraph).isNotInstanceOf(MutableValueGraph.class);
    assertThat(immutableGraph).isEqualTo(mutableGraph);

            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 35

                @Test
  public void immutableGraph() {
    MutableGraph<String> mutableGraph = GraphBuilder.directed().build();
    mutableGraph.addNode("A");
    ImmutableGraph<String> immutableGraph = ImmutableGraph.copyOf(mutableGraph);

    assertThat(immutableGraph).isNotInstanceOf(MutableValueGraph.class);
    assertThat(immutableGraph).isEqualTo(mutableGraph);


            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 38

                  mutableGraph.addNode("A");
    ImmutableGraph<String> immutableGraph = ImmutableGraph.copyOf(mutableGraph);

    assertThat(immutableGraph).isNotInstanceOf(MutableValueGraph.class);
    assertThat(immutableGraph).isEqualTo(mutableGraph);

    mutableGraph.addNode("B");
    assertThat(immutableGraph).isNotEqualTo(mutableGraph);
  }

            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 39

                  ImmutableGraph<String> immutableGraph = ImmutableGraph.copyOf(mutableGraph);

    assertThat(immutableGraph).isNotInstanceOf(MutableValueGraph.class);
    assertThat(immutableGraph).isEqualTo(mutableGraph);

    mutableGraph.addNode("B");
    assertThat(immutableGraph).isNotEqualTo(mutableGraph);
  }


            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 41

                  assertThat(immutableGraph).isNotInstanceOf(MutableValueGraph.class);
    assertThat(immutableGraph).isEqualTo(mutableGraph);

    mutableGraph.addNode("B");
    assertThat(immutableGraph).isNotEqualTo(mutableGraph);
  }

  @Test
  public void copyOfImmutableGraph_optimized() {

            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 42

                  assertThat(immutableGraph).isEqualTo(mutableGraph);

    mutableGraph.addNode("B");
    assertThat(immutableGraph).isNotEqualTo(mutableGraph);
  }

  @Test
  public void copyOfImmutableGraph_optimized() {
    Graph<String> graph1 = ImmutableGraph.copyOf(GraphBuilder.directed().<String>build());

            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 47

              
  @Test
  public void copyOfImmutableGraph_optimized() {
    Graph<String> graph1 = ImmutableGraph.copyOf(GraphBuilder.directed().<String>build());
    Graph<String> graph2 = ImmutableGraph.copyOf(graph1);

    assertThat(graph2).isSameInstanceAs(graph1);
  }


            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 50

                  Graph<String> graph1 = ImmutableGraph.copyOf(GraphBuilder.directed().<String>build());
    Graph<String> graph2 = ImmutableGraph.copyOf(graph1);

    assertThat(graph2).isSameInstanceAs(graph1);
  }

  @Test
  public void immutableGraphBuilder_appliesGraphBuilderConfig() {
    ImmutableGraph<String> emptyGraph =

            

Reported by PMD.

Unit tests should not contain more than 1 assert(s).
Design

Line: 54

                }

  @Test
  public void immutableGraphBuilder_appliesGraphBuilderConfig() {
    ImmutableGraph<String> emptyGraph =
        GraphBuilder.directed()
            .allowsSelfLoops(true)
            .nodeOrder(ElementOrder.<String>natural())
            .immutable()

            

Reported by PMD.

android/guava-tests/test/com/google/common/util/concurrent/SimpleTimeLimiterTest.java
62 issues
Avoid throwing raw exception types.
Design

Line: 68

                        try {
            MILLISECONDS.sleep(DELAY_MS);
          } catch (InterruptedException e) {
            throw new RuntimeException(e);
          }
        }
      };
  private static final Runnable BAD_RUNNABLE =
      new Runnable() {

            

Reported by PMD.

Avoid throwing raw exception types.
Design

Line: 79

                        try {
            MILLISECONDS.sleep(DELAY_MS);
          } catch (InterruptedException e) {
            throw new RuntimeException(e);
          }
          throw new SampleRuntimeException();
        }
      };


            

Reported by PMD.

This class has too many methods, consider refactoring it.
Design

Line: 38

               * @author Jens Nyman
 */

public class SimpleTimeLimiterTest extends TestCase {

  private static final long DELAY_MS = 50;
  private static final long ENOUGH_MS = 10000;
  private static final long NOT_ENOUGH_MS = 5;


            

Reported by PMD.

Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 85

                      }
      };

  private TimeLimiter service;

  private static final ExecutorService executor = Executors.newFixedThreadPool(1);

  @Override
  protected void setUp() throws Exception {

            

Reported by PMD.

JUnit 4 tests that set up tests should use the @Before annotation, JUnit5 tests should use @BeforeEach or @BeforeAll
Design

Line: 89

              
  private static final ExecutorService executor = Executors.newFixedThreadPool(1);

  @Override
  protected void setUp() throws Exception {
    super.setUp();
    service = SimpleTimeLimiter.create(executor);
  }


            

Reported by PMD.

JUnit 4 tests that execute tests should use the @Test annotation, JUnit 5 tests should use @Test, @RepeatedTest, @TestFactory, @TestTemplate or @ParameterizedTest
Design

Line: 95

                  service = SimpleTimeLimiter.create(executor);
  }

  public void testNewProxy_goodMethodWithEnoughTime() throws Exception {
    SampleImpl target = new SampleImpl(DELAY_MS);
    Sample proxy = service.newProxy(target, Sample.class, ENOUGH_MS, MILLISECONDS);
    Stopwatch stopwatch = Stopwatch.createStarted();

    String result = proxy.sleepThenReturnInput("x");

            

Reported by PMD.

Unit tests should not contain more than 1 assert(s).
Design

Line: 95

                  service = SimpleTimeLimiter.create(executor);
  }

  public void testNewProxy_goodMethodWithEnoughTime() throws Exception {
    SampleImpl target = new SampleImpl(DELAY_MS);
    Sample proxy = service.newProxy(target, Sample.class, ENOUGH_MS, MILLISECONDS);
    Stopwatch stopwatch = Stopwatch.createStarted();

    String result = proxy.sleepThenReturnInput("x");

            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 100

                  Sample proxy = service.newProxy(target, Sample.class, ENOUGH_MS, MILLISECONDS);
    Stopwatch stopwatch = Stopwatch.createStarted();

    String result = proxy.sleepThenReturnInput("x");

    assertThat(result).isEqualTo("x");
    assertThat(stopwatch.elapsed(MILLISECONDS)).isIn(Range.closed(DELAY_MS, ENOUGH_MS));
    assertThat(target.finished).isTrue();
  }

            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 102

              
    String result = proxy.sleepThenReturnInput("x");

    assertThat(result).isEqualTo("x");
    assertThat(stopwatch.elapsed(MILLISECONDS)).isIn(Range.closed(DELAY_MS, ENOUGH_MS));
    assertThat(target.finished).isTrue();
  }

  public void testNewProxy_goodMethodWithNotEnoughTime() throws Exception {

            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 103

                  String result = proxy.sleepThenReturnInput("x");

    assertThat(result).isEqualTo("x");
    assertThat(stopwatch.elapsed(MILLISECONDS)).isIn(Range.closed(DELAY_MS, ENOUGH_MS));
    assertThat(target.finished).isTrue();
  }

  public void testNewProxy_goodMethodWithNotEnoughTime() throws Exception {
    SampleImpl target = new SampleImpl(9999);

            

Reported by PMD.

guava-testlib/src/com/google/common/collect/testing/google/MultimapTestSuiteBuilder.java
62 issues
A high number of imports can indicate a high degree of coupling within an object.
Design

Line: 17

               * limitations under the License.
 */

package com.google.common.collect.testing.google;

import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.collect.testing.Helpers.mapEntry;

import com.google.common.annotations.GwtIncompatible;

            

Reported by PMD.

High amount of different objects as members denotes a high coupling
Design

Line: 17

               * limitations under the License.
 */

package com.google.common.collect.testing.google;

import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.collect.testing.Helpers.mapEntry;

import com.google.common.annotations.GwtIncompatible;

            

Reported by PMD.

This class has too many methods, consider refactoring it.
Design

Line: 68

              @GwtIncompatible
public class MultimapTestSuiteBuilder<K, V, M extends Multimap<K, V>>
    extends PerCollectionSizeTestSuiteBuilder<
        MultimapTestSuiteBuilder<K, V, M>, TestMultimapGenerator<K, V, M>, M, Entry<K, V>> {

  public static <K, V, M extends Multimap<K, V>> MultimapTestSuiteBuilder<K, V, M> using(
      TestMultimapGenerator<K, V, M> generator) {
    return new MultimapTestSuiteBuilder<K, V, M>().usingGenerator(generator);
  }

            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 112

              
    List<TestSuite> derivedSuites = super.createDerivedSuites(parentBuilder);

    if (parentBuilder.getFeatures().contains(CollectionFeature.SERIALIZABLE)) {
      derivedSuites.add(
          MultimapTestSuiteBuilder.using(
                  new ReserializedMultimapGenerator<K, V, M>(parentBuilder.getSubjectGenerator()))
              .withFeatures(computeReserializedMultimapFeatures(parentBuilder.getFeatures()))
              .named(parentBuilder.getName() + " reserialized")

            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 133

                          .withTearDown(parentBuilder.getTearDown())
            .createTestSuite());

    derivedSuites.add(computeEntriesTestSuite(parentBuilder));
    derivedSuites.add(computeMultimapGetTestSuite(parentBuilder));
    derivedSuites.add(computeMultimapAsMapGetTestSuite(parentBuilder));
    derivedSuites.add(computeKeysTestSuite(parentBuilder));
    derivedSuites.add(computeValuesTestSuite(parentBuilder));


            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 134

                          .createTestSuite());

    derivedSuites.add(computeEntriesTestSuite(parentBuilder));
    derivedSuites.add(computeMultimapGetTestSuite(parentBuilder));
    derivedSuites.add(computeMultimapAsMapGetTestSuite(parentBuilder));
    derivedSuites.add(computeKeysTestSuite(parentBuilder));
    derivedSuites.add(computeValuesTestSuite(parentBuilder));

    return derivedSuites;

            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 135

              
    derivedSuites.add(computeEntriesTestSuite(parentBuilder));
    derivedSuites.add(computeMultimapGetTestSuite(parentBuilder));
    derivedSuites.add(computeMultimapAsMapGetTestSuite(parentBuilder));
    derivedSuites.add(computeKeysTestSuite(parentBuilder));
    derivedSuites.add(computeValuesTestSuite(parentBuilder));

    return derivedSuites;
  }

            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 136

                  derivedSuites.add(computeEntriesTestSuite(parentBuilder));
    derivedSuites.add(computeMultimapGetTestSuite(parentBuilder));
    derivedSuites.add(computeMultimapAsMapGetTestSuite(parentBuilder));
    derivedSuites.add(computeKeysTestSuite(parentBuilder));
    derivedSuites.add(computeValuesTestSuite(parentBuilder));

    return derivedSuites;
  }


            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 137

                  derivedSuites.add(computeMultimapGetTestSuite(parentBuilder));
    derivedSuites.add(computeMultimapAsMapGetTestSuite(parentBuilder));
    derivedSuites.add(computeKeysTestSuite(parentBuilder));
    derivedSuites.add(computeValuesTestSuite(parentBuilder));

    return derivedSuites;
  }

  TestSuite computeValuesTestSuite(

            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 212

              
  static Set<Feature<?>> computeDerivedCollectionFeatures(Set<Feature<?>> multimapFeatures) {
    Set<Feature<?>> derivedFeatures = Helpers.copyToSet(multimapFeatures);
    if (!derivedFeatures.remove(CollectionFeature.SERIALIZABLE_INCLUDING_VIEWS)) {
      derivedFeatures.remove(CollectionFeature.SERIALIZABLE);
    }
    if (derivedFeatures.remove(MapFeature.SUPPORTS_REMOVE)) {
      derivedFeatures.add(CollectionFeature.SUPPORTS_REMOVE);
    }

            

Reported by PMD.

guava-tests/test/com/google/common/util/concurrent/SimpleTimeLimiterTest.java
62 issues
Avoid throwing raw exception types.
Design

Line: 68

                        try {
            MILLISECONDS.sleep(DELAY_MS);
          } catch (InterruptedException e) {
            throw new RuntimeException(e);
          }
        }
      };
  private static final Runnable BAD_RUNNABLE =
      new Runnable() {

            

Reported by PMD.

Avoid throwing raw exception types.
Design

Line: 79

                        try {
            MILLISECONDS.sleep(DELAY_MS);
          } catch (InterruptedException e) {
            throw new RuntimeException(e);
          }
          throw new SampleRuntimeException();
        }
      };


            

Reported by PMD.

This class has too many methods, consider refactoring it.
Design

Line: 38

               * @author Jens Nyman
 */

public class SimpleTimeLimiterTest extends TestCase {

  private static final long DELAY_MS = 50;
  private static final long ENOUGH_MS = 10000;
  private static final long NOT_ENOUGH_MS = 5;


            

Reported by PMD.

Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 85

                      }
      };

  private TimeLimiter service;

  private static final ExecutorService executor = Executors.newFixedThreadPool(1);

  @Override
  protected void setUp() throws Exception {

            

Reported by PMD.

JUnit 4 tests that set up tests should use the @Before annotation, JUnit5 tests should use @BeforeEach or @BeforeAll
Design

Line: 89

              
  private static final ExecutorService executor = Executors.newFixedThreadPool(1);

  @Override
  protected void setUp() throws Exception {
    super.setUp();
    service = SimpleTimeLimiter.create(executor);
  }


            

Reported by PMD.

Unit tests should not contain more than 1 assert(s).
Design

Line: 95

                  service = SimpleTimeLimiter.create(executor);
  }

  public void testNewProxy_goodMethodWithEnoughTime() throws Exception {
    SampleImpl target = new SampleImpl(DELAY_MS);
    Sample proxy = service.newProxy(target, Sample.class, ENOUGH_MS, MILLISECONDS);
    Stopwatch stopwatch = Stopwatch.createStarted();

    String result = proxy.sleepThenReturnInput("x");

            

Reported by PMD.

JUnit 4 tests that execute tests should use the @Test annotation, JUnit 5 tests should use @Test, @RepeatedTest, @TestFactory, @TestTemplate or @ParameterizedTest
Design

Line: 95

                  service = SimpleTimeLimiter.create(executor);
  }

  public void testNewProxy_goodMethodWithEnoughTime() throws Exception {
    SampleImpl target = new SampleImpl(DELAY_MS);
    Sample proxy = service.newProxy(target, Sample.class, ENOUGH_MS, MILLISECONDS);
    Stopwatch stopwatch = Stopwatch.createStarted();

    String result = proxy.sleepThenReturnInput("x");

            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 100

                  Sample proxy = service.newProxy(target, Sample.class, ENOUGH_MS, MILLISECONDS);
    Stopwatch stopwatch = Stopwatch.createStarted();

    String result = proxy.sleepThenReturnInput("x");

    assertThat(result).isEqualTo("x");
    assertThat(stopwatch.elapsed(MILLISECONDS)).isIn(Range.closed(DELAY_MS, ENOUGH_MS));
    assertThat(target.finished).isTrue();
  }

            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 102

              
    String result = proxy.sleepThenReturnInput("x");

    assertThat(result).isEqualTo("x");
    assertThat(stopwatch.elapsed(MILLISECONDS)).isIn(Range.closed(DELAY_MS, ENOUGH_MS));
    assertThat(target.finished).isTrue();
  }

  public void testNewProxy_goodMethodWithNotEnoughTime() throws Exception {

            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 103

                  String result = proxy.sleepThenReturnInput("x");

    assertThat(result).isEqualTo("x");
    assertThat(stopwatch.elapsed(MILLISECONDS)).isIn(Range.closed(DELAY_MS, ENOUGH_MS));
    assertThat(target.finished).isTrue();
  }

  public void testNewProxy_goodMethodWithNotEnoughTime() throws Exception {
    SampleImpl target = new SampleImpl(9999);

            

Reported by PMD.

android/guava-testlib/src/com/google/common/collect/testing/google/MultimapTestSuiteBuilder.java
62 issues
A high number of imports can indicate a high degree of coupling within an object.
Design

Line: 17

               * limitations under the License.
 */

package com.google.common.collect.testing.google;

import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.collect.testing.Helpers.mapEntry;

import com.google.common.annotations.GwtIncompatible;

            

Reported by PMD.

High amount of different objects as members denotes a high coupling
Design

Line: 17

               * limitations under the License.
 */

package com.google.common.collect.testing.google;

import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.collect.testing.Helpers.mapEntry;

import com.google.common.annotations.GwtIncompatible;

            

Reported by PMD.

This class has too many methods, consider refactoring it.
Design

Line: 68

              @GwtIncompatible
public class MultimapTestSuiteBuilder<K, V, M extends Multimap<K, V>>
    extends PerCollectionSizeTestSuiteBuilder<
        MultimapTestSuiteBuilder<K, V, M>, TestMultimapGenerator<K, V, M>, M, Entry<K, V>> {

  public static <K, V, M extends Multimap<K, V>> MultimapTestSuiteBuilder<K, V, M> using(
      TestMultimapGenerator<K, V, M> generator) {
    return new MultimapTestSuiteBuilder<K, V, M>().usingGenerator(generator);
  }

            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 111

              
    List<TestSuite> derivedSuites = super.createDerivedSuites(parentBuilder);

    if (parentBuilder.getFeatures().contains(CollectionFeature.SERIALIZABLE)) {
      derivedSuites.add(
          MultimapTestSuiteBuilder.using(
                  new ReserializedMultimapGenerator<K, V, M>(parentBuilder.getSubjectGenerator()))
              .withFeatures(computeReserializedMultimapFeatures(parentBuilder.getFeatures()))
              .named(parentBuilder.getName() + " reserialized")

            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 132

                          .withTearDown(parentBuilder.getTearDown())
            .createTestSuite());

    derivedSuites.add(computeEntriesTestSuite(parentBuilder));
    derivedSuites.add(computeMultimapGetTestSuite(parentBuilder));
    derivedSuites.add(computeMultimapAsMapGetTestSuite(parentBuilder));
    derivedSuites.add(computeKeysTestSuite(parentBuilder));
    derivedSuites.add(computeValuesTestSuite(parentBuilder));


            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 133

                          .createTestSuite());

    derivedSuites.add(computeEntriesTestSuite(parentBuilder));
    derivedSuites.add(computeMultimapGetTestSuite(parentBuilder));
    derivedSuites.add(computeMultimapAsMapGetTestSuite(parentBuilder));
    derivedSuites.add(computeKeysTestSuite(parentBuilder));
    derivedSuites.add(computeValuesTestSuite(parentBuilder));

    return derivedSuites;

            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 134

              
    derivedSuites.add(computeEntriesTestSuite(parentBuilder));
    derivedSuites.add(computeMultimapGetTestSuite(parentBuilder));
    derivedSuites.add(computeMultimapAsMapGetTestSuite(parentBuilder));
    derivedSuites.add(computeKeysTestSuite(parentBuilder));
    derivedSuites.add(computeValuesTestSuite(parentBuilder));

    return derivedSuites;
  }

            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 135

                  derivedSuites.add(computeEntriesTestSuite(parentBuilder));
    derivedSuites.add(computeMultimapGetTestSuite(parentBuilder));
    derivedSuites.add(computeMultimapAsMapGetTestSuite(parentBuilder));
    derivedSuites.add(computeKeysTestSuite(parentBuilder));
    derivedSuites.add(computeValuesTestSuite(parentBuilder));

    return derivedSuites;
  }


            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 136

                  derivedSuites.add(computeMultimapGetTestSuite(parentBuilder));
    derivedSuites.add(computeMultimapAsMapGetTestSuite(parentBuilder));
    derivedSuites.add(computeKeysTestSuite(parentBuilder));
    derivedSuites.add(computeValuesTestSuite(parentBuilder));

    return derivedSuites;
  }

  TestSuite computeValuesTestSuite(

            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 211

              
  static Set<Feature<?>> computeDerivedCollectionFeatures(Set<Feature<?>> multimapFeatures) {
    Set<Feature<?>> derivedFeatures = Helpers.copyToSet(multimapFeatures);
    if (!derivedFeatures.remove(CollectionFeature.SERIALIZABLE_INCLUDING_VIEWS)) {
      derivedFeatures.remove(CollectionFeature.SERIALIZABLE);
    }
    if (derivedFeatures.remove(MapFeature.SUPPORTS_REMOVE)) {
      derivedFeatures.add(CollectionFeature.SUPPORTS_REMOVE);
    }

            

Reported by PMD.

guava-tests/test/com/google/common/util/concurrent/JdkFutureAdaptersTest.java
62 issues
Avoid throwing raw exception types.
Design

Line: 202

                     * value is set in addition to the call we'll make after then.
       */
      allowGetToComplete.await(1, SECONDS);
      throw new RuntimeException("expected, should be caught");
    }

    @Override
    public V get(long timeout, TimeUnit unit) {
      throw new AssertionFailedError();

            

Reported by PMD.

JUnit 4 tests that execute tests should use the @Test annotation, JUnit 5 tests should use @Test, @RepeatedTest, @TestFactory, @TestTemplate or @ParameterizedTest
Design

Line: 46

              public class JdkFutureAdaptersTest extends TestCase {
  private static final String DATA1 = "data";

  public void testListenInPoolThreadReturnsSameFuture() throws Exception {
    ListenableFuture<String> listenableFuture = immediateFuture(DATA1);
    assertSame(listenableFuture, listenInPoolThread(listenableFuture));
  }

  private static class SingleCallListener implements Runnable {

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 48

              
  public void testListenInPoolThreadReturnsSameFuture() throws Exception {
    ListenableFuture<String> listenableFuture = immediateFuture(DATA1);
    assertSame(listenableFuture, listenInPoolThread(listenableFuture));
  }

  private static class SingleCallListener implements Runnable {

    private boolean expectCall = false;

            

Reported by PMD.

Field expectCall has the same name as a method
Error

Line: 53

              
  private static class SingleCallListener implements Runnable {

    private boolean expectCall = false;
    private final CountDownLatch calledCountDown = new CountDownLatch(1);

    @Override
    public void run() {
      assertTrue("Listener called before it was expected", expectCall);

            

Reported by PMD.

Avoid using redundant field initializer for 'expectCall'
Performance

Line: 53

              
  private static class SingleCallListener implements Runnable {

    private boolean expectCall = false;
    private final CountDownLatch calledCountDown = new CountDownLatch(1);

    @Override
    public void run() {
      assertTrue("Listener called before it was expected", expectCall);

            

Reported by PMD.

Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 53

              
  private static class SingleCallListener implements Runnable {

    private boolean expectCall = false;
    private final CountDownLatch calledCountDown = new CountDownLatch(1);

    @Override
    public void run() {
      assertTrue("Listener called before it was expected", expectCall);

            

Reported by PMD.

Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 54

                private static class SingleCallListener implements Runnable {

    private boolean expectCall = false;
    private final CountDownLatch calledCountDown = new CountDownLatch(1);

    @Override
    public void run() {
      assertTrue("Listener called before it was expected", expectCall);
      assertFalse("Listener called more than once", wasCalled());

            

Reported by PMD.

JUnit 4 tests that execute tests should use the @Test annotation, JUnit 5 tests should use @Test, @RepeatedTest, @TestFactory, @TestTemplate or @ParameterizedTest
Design

Line: 78

                  }
  }

  public void testListenInPoolThreadIgnoresExecutorWhenDelegateIsDone() throws Exception {
    NonListenableSettableFuture<String> abstractFuture = NonListenableSettableFuture.create();
    abstractFuture.set(DATA1);
    ExecutorSpy spy = new ExecutorSpy(directExecutor());
    ListenableFuture<String> listenableFuture = listenInPoolThread(abstractFuture, spy);


            

Reported by PMD.

Unit tests should not contain more than 1 assert(s).
Design

Line: 78

                  }
  }

  public void testListenInPoolThreadIgnoresExecutorWhenDelegateIsDone() throws Exception {
    NonListenableSettableFuture<String> abstractFuture = NonListenableSettableFuture.create();
    abstractFuture.set(DATA1);
    ExecutorSpy spy = new ExecutorSpy(directExecutor());
    ListenableFuture<String> listenableFuture = listenInPoolThread(abstractFuture, spy);


            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 80

              
  public void testListenInPoolThreadIgnoresExecutorWhenDelegateIsDone() throws Exception {
    NonListenableSettableFuture<String> abstractFuture = NonListenableSettableFuture.create();
    abstractFuture.set(DATA1);
    ExecutorSpy spy = new ExecutorSpy(directExecutor());
    ListenableFuture<String> listenableFuture = listenInPoolThread(abstractFuture, spy);

    SingleCallListener singleCallListener = new SingleCallListener();
    singleCallListener.expectCall();

            

Reported by PMD.

android/guava-tests/test/com/google/common/util/concurrent/JdkFutureAdaptersTest.java
62 issues
Avoid throwing raw exception types.
Design

Line: 202

                     * value is set in addition to the call we'll make after then.
       */
      allowGetToComplete.await(1, SECONDS);
      throw new RuntimeException("expected, should be caught");
    }

    @Override
    public V get(long timeout, TimeUnit unit) {
      throw new AssertionFailedError();

            

Reported by PMD.

JUnit 4 tests that execute tests should use the @Test annotation, JUnit 5 tests should use @Test, @RepeatedTest, @TestFactory, @TestTemplate or @ParameterizedTest
Design

Line: 46

              public class JdkFutureAdaptersTest extends TestCase {
  private static final String DATA1 = "data";

  public void testListenInPoolThreadReturnsSameFuture() throws Exception {
    ListenableFuture<String> listenableFuture = immediateFuture(DATA1);
    assertSame(listenableFuture, listenInPoolThread(listenableFuture));
  }

  private static class SingleCallListener implements Runnable {

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 48

              
  public void testListenInPoolThreadReturnsSameFuture() throws Exception {
    ListenableFuture<String> listenableFuture = immediateFuture(DATA1);
    assertSame(listenableFuture, listenInPoolThread(listenableFuture));
  }

  private static class SingleCallListener implements Runnable {

    private boolean expectCall = false;

            

Reported by PMD.

Avoid using redundant field initializer for 'expectCall'
Performance

Line: 53

              
  private static class SingleCallListener implements Runnable {

    private boolean expectCall = false;
    private final CountDownLatch calledCountDown = new CountDownLatch(1);

    @Override
    public void run() {
      assertTrue("Listener called before it was expected", expectCall);

            

Reported by PMD.

Field expectCall has the same name as a method
Error

Line: 53

              
  private static class SingleCallListener implements Runnable {

    private boolean expectCall = false;
    private final CountDownLatch calledCountDown = new CountDownLatch(1);

    @Override
    public void run() {
      assertTrue("Listener called before it was expected", expectCall);

            

Reported by PMD.

Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 53

              
  private static class SingleCallListener implements Runnable {

    private boolean expectCall = false;
    private final CountDownLatch calledCountDown = new CountDownLatch(1);

    @Override
    public void run() {
      assertTrue("Listener called before it was expected", expectCall);

            

Reported by PMD.

Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 54

                private static class SingleCallListener implements Runnable {

    private boolean expectCall = false;
    private final CountDownLatch calledCountDown = new CountDownLatch(1);

    @Override
    public void run() {
      assertTrue("Listener called before it was expected", expectCall);
      assertFalse("Listener called more than once", wasCalled());

            

Reported by PMD.

JUnit 4 tests that execute tests should use the @Test annotation, JUnit 5 tests should use @Test, @RepeatedTest, @TestFactory, @TestTemplate or @ParameterizedTest
Design

Line: 78

                  }
  }

  public void testListenInPoolThreadIgnoresExecutorWhenDelegateIsDone() throws Exception {
    NonListenableSettableFuture<String> abstractFuture = NonListenableSettableFuture.create();
    abstractFuture.set(DATA1);
    ExecutorSpy spy = new ExecutorSpy(directExecutor());
    ListenableFuture<String> listenableFuture = listenInPoolThread(abstractFuture, spy);


            

Reported by PMD.

Unit tests should not contain more than 1 assert(s).
Design

Line: 78

                  }
  }

  public void testListenInPoolThreadIgnoresExecutorWhenDelegateIsDone() throws Exception {
    NonListenableSettableFuture<String> abstractFuture = NonListenableSettableFuture.create();
    abstractFuture.set(DATA1);
    ExecutorSpy spy = new ExecutorSpy(directExecutor());
    ListenableFuture<String> listenableFuture = listenInPoolThread(abstractFuture, spy);


            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 80

              
  public void testListenInPoolThreadIgnoresExecutorWhenDelegateIsDone() throws Exception {
    NonListenableSettableFuture<String> abstractFuture = NonListenableSettableFuture.create();
    abstractFuture.set(DATA1);
    ExecutorSpy spy = new ExecutorSpy(directExecutor());
    ListenableFuture<String> listenableFuture = listenInPoolThread(abstractFuture, spy);

    SingleCallListener singleCallListener = new SingleCallListener();
    singleCallListener.expectCall();

            

Reported by PMD.