### Question:
MethodChainDetector extends CodeSmellDetector { public Metric createMetric(final int val) { return new Metric("Method Invocation Distance", val); } MethodChainDetector(@NonNull final Environment environment,
			final int threshold);  MethodChainDetector(@NonNull final Environment environment); @Override CodeSmell.Definition getDefinition(); Metric createMetric(final int val);  }### Answer:
@Test public void test001() throws IOException { RevisionMock revision = new RevisionMock(folder); revision.addFile(Paths.get("method_chain", "MethodChainClass.java")); RevisionRange revisionRange = mock(RevisionRange.class); when(revisionRange.getRevision()).thenReturn(revision); Launcher launcher = new Launcher(); launcher.addInputResource(folder.getRoot().getAbsolutePath()); CtModel model = launcher.buildModel(); Environment environment = new Environment(model, revisionRange); MethodChainDetector mcDetector = new MethodChainDetector(environment, 4); mcDetector.scan(model); List<CodeSmell> codeSmells = mcDetector.getCodeSmells(); assertThat(codeSmells).hasSize(1); CodeSmell codeSmell = codeSmells.get(0); assertThat(codeSmell.getMetrics()).containsOnlyOnce( mcDetector.createMetric(4)); assertThat(codeSmell.getRanges()).hasSize(1).first() .matches(range -> range.getBegin().getLine() == 5) .matches(range -> range.getBegin().getColumn() == 28) .matches(range -> range.getEnd().getLine() == 5) .matches(range -> range.getEnd().getColumn() == 56); }