Repository: assertj/assertj

Problem statement:
Add `hasFileName` as an alias of `hasName` for `File` assertions
#### Example

```java
assertThat(new File("file.txt")).hasFileName("file.txt");
```

Related to #2205.


Hints:
Hey, Can I pick this up?
Sure @ShivakumarSwamy, go for it!

Patch:
diff --git a/src/main/java/org/assertj/core/api/AbstractFileAssert.java b/src/main/java/org/assertj/core/api/AbstractFileAssert.java
--- a/src/main/java/org/assertj/core/api/AbstractFileAssert.java
+++ b/src/main/java/org/assertj/core/api/AbstractFileAssert.java
@@ -19,6 +19,7 @@
 import java.io.UncheckedIOException;
 import java.nio.charset.Charset;
 import java.nio.file.FileSystem;
+import java.nio.file.Path;
 import java.security.MessageDigest;
 import java.util.function.Predicate;
 
@@ -685,12 +686,43 @@ public SELF hasExtension(String expected) {
    * @throws AssertionError if the actual {@code File} does not have the expected name.
    *
    * @see java.io.File#getName() name definition.
+   * @see #hasFileName(String)
    */
   public SELF hasName(String expected) {
     files.assertHasName(info, actual, expected);
     return myself;
   }
 
+  /**
+   * Verifies that the actual {@code File} has given name (alias of {@link #hasName(String)}).
+   *
+   * <p>
+   * Example:
+   * <pre><code class='java'> File xFile = new File(&quot;somewhere/xFile.java&quot;);
+   * File xDirectory = new File(&quot;somewhere/xDirectory&quot;);
+   *
+   * // assertion will pass
+   * assertThat(xFile).hasFileName(&quot;xFile.java&quot;);
+   * assertThat(xDirectory).hasFileName(&quot;xDirectory&quot;);
+   *
+   * // assertion will fail
+   * assertThat(xFile).hasFileName(&quot;xFile&quot;);
+   * assertThat(xDirectory).hasFileName(&quot;somewhere&quot;);</code></pre>
+   *
+   * @param expected the expected {@code File} name.
+   * @return {@code this} assertion object.
+   * @throws NullPointerException if the expected name is {@code null}.
+   * @throws AssertionError if the actual {@code File} is {@code null}.
+   * @throws AssertionError if the actual {@code File} does not have the expected name.
+   *
+   * @see java.io.File#getName() name definition.
+   * @see #hasName(String)
+   * @since 3.21.0
+   */
+  public SELF hasFileName(String expected) {
+    return hasName(expected);
+  }
+
   /**
    * Verifies that the actual {@code File} does not have a parent.
    *


Test patch:
diff --git a/src/test/java/org/assertj/core/api/file/FileAssert_hasFileName_Test.java b/src/test/java/org/assertj/core/api/file/FileAssert_hasFileName_Test.java
new file mode 100644
--- /dev/null
+++ b/src/test/java/org/assertj/core/api/file/FileAssert_hasFileName_Test.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations under the License.
+ *
+ * Copyright 2012-2021 the original author or authors.
+ */
+package org.assertj.core.api.file;
+
+import static org.mockito.Mockito.verify;
+
+import org.assertj.core.api.FileAssert;
+import org.assertj.core.api.FileAssertBaseTest;
+
+class FileAssert_hasFileName_Test extends FileAssertBaseTest {
+
+  private final String expected = "expected.name";
+
+  @Override
+  protected FileAssert invoke_api_method() {
+    return assertions.hasFileName(expected);
+  }
+
+  @Override
+  protected void verify_internal_effects() {
+    verify(files).assertHasName(getInfo(assertions), getActual(assertions), expected);
+  }
+}