### Question:
Approval { @Nonnull public static Path getApprovalPath(Path filePath) { Pre.notNull(filePath, "filePath"); String s = filePath.toString(); int extensionIndex = s.lastIndexOf('.'); if (extensionIndex == -1) { return Paths.get(s + FOR_APPROVAL_EXTENSION); } int lastPartOfPath = s.lastIndexOf('/'); if (lastPartOfPath != -1 && lastPartOfPath > extensionIndex) { return Paths.get(s + FOR_APPROVAL_EXTENSION); } String firstPart = s.substring(0, extensionIndex); String extension = s.substring(extensionIndex); return Paths.get(firstPart + FOR_APPROVAL_EXTENSION + extension); } Approval(Reporter reporter, Converter<T> converter, @Nullable PathMapper<T> pathMapper);   Approval(Reporter reporter, Converter<T> converter, @Nullable PathMapper<T> pathMapper, com.github.approval.utils.FileSystemUtils fileSystemReadWriter); @Nonnull static ApprovalBuilder<T> of(Class<T> clazz); @Nonnull static Path getApprovalPath(Path filePath); void verify(@Nullable T value, Path filePath);  }### Answer:
@Test public void getApprovalPathShouldPreserveExtensionForSyntaxHighlighting() throws Exception { Path approvalPath = Approval.getApprovalPath(Paths.get("test/some/directory/file.txt")); Assert.assertThat(approvalPath.toString(), CoreMatchers.equalTo("test/some/directory/file.forapproval.txt")); approvalPath = Approval.getApprovalPath(Paths.get("test/some/directory.with.dots/file.txt")); Assert.assertThat(approvalPath.toString(), CoreMatchers.equalTo("test/some/directory.with.dots/file.forapproval.txt")); approvalPath = Approval.getApprovalPath(Paths.get("test/some/directory.with.dots/file.withTooBigExtension")); Assert.assertThat(approvalPath.toString(), CoreMatchers.equalTo("test/some/directory.with.dots/file.forapproval.withTooBigExtension")); approvalPath = Approval.getApprovalPath(Paths.get("test/some/directory/fileWithoutExtension")); Assert.assertThat(approvalPath.toString(), CoreMatchers.equalTo("test/some/directory/fileWithoutExtension.forapproval")); approvalPath = Approval.getApprovalPath(Paths.get("test/some/directory.with.dots/fileWithoutExtension")); Assert.assertThat(approvalPath.toString(), CoreMatchers.equalTo("test/some/directory.with.dots/fileWithoutExtension.forapproval")); approvalPath = Approval.getApprovalPath(Paths.get("fileNotInDir")); Assert.assertThat(approvalPath.toString(), CoreMatchers.equalTo("fileNotInDir.forapproval")); approvalPath = Approval.getApprovalPath(Paths.get("fileNotInDir.ext")); Assert.assertThat(approvalPath.toString(), CoreMatchers.equalTo("fileNotInDir.forapproval.ext")); }