• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

devonfw / IDEasy / 16913925651

12 Aug 2025 03:48PM UTC coverage: 69.496% (+0.03%) from 69.463%
16913925651

push

github

web-flow
#1437: cleanup (#1439)

3365 of 5285 branches covered (63.67%)

Branch coverage included in aggregate %.

8744 of 12139 relevant lines covered (72.03%)

3.16 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

89.66
cli/src/main/java/com/devonfw/tools/ide/io/FileCopyMode.java
1
package com.devonfw.tools.ide.io;
2

3
/**
4
 * {@link Enum} with the available modes to {@link FileAccess#copy(java.nio.file.Path, java.nio.file.Path, FileCopyMode) copy} files and folders.
5
 */
6
public enum FileCopyMode {
3✔
7

8
  /** Copy {@link #isFileOnly() only a single file} and {@link #isFailIfExists() fail if the target-file already exists}. */
9
  COPY_FILE_FAIL_IF_EXISTS(true, false, true),
10✔
10

11
  /** Copy {@link #isFileOnly() only a single file} and override the target-file if it already exists. */
12
  COPY_FILE_OVERRIDE(true, true, true),
10✔
13

14
  /** Copy {@link #isFileOnly() only a single file} and override the target-file if it already exists. */
15
  COPY_FILE_TO_TARGET_OVERRIDE(true, true, false),
10✔
16

17
  /** Copy {@link #isRecursive() recursively} and {@link #isFailIfExists() fail if the target-path already exists}. */
18
  COPY_TREE_FAIL_IF_EXISTS(false, false, true),
10✔
19

20
  /** Copy {@link #isRecursive() recursively} and override existing files but merge existing folders. */
21
  COPY_TREE_OVERRIDE_FILES(false, true, true),
10✔
22

23
  /** Copy {@link #isRecursive() recursively} from virtual filesystem of a compressed archive and override existing files but merge existing folders. */
24
  EXTRACT(false, null, true),
9✔
25

26
  /** Copy {@link #isRecursive() recursively} and {@link FileAccess#delete(java.nio.file.Path) delete} the target-file if it exists before copying. */
27
  COPY_TREE_OVERRIDE_TREE(false, true, true),
10✔
28

29
  /** Copy {@link #isRecursive() recursively} and append the file name to the target. */
30
  COPY_TREE_CONTENT(false, null, false);
9✔
31

32
  private final boolean fileOnly;
33

34
  private final Boolean override;
35

36
  private final boolean useSourceFilename;
37

38
  private FileCopyMode(boolean fileOnly, Boolean override, boolean useSourceFilename) {
4✔
39
    this.fileOnly = fileOnly;
3✔
40
    this.override = override;
3✔
41
    this.useSourceFilename = useSourceFilename;
3✔
42
  }
1✔
43

44
  /**
45
   * @return {@code true} if only a single file shall be copied. Will fail if a directory is given to copy, {@code false} otherwise (to copy folders
46
   *     recursively).
47
   */
48
  public boolean isFileOnly() {
49

50
    return this.fileOnly;
3✔
51
  }
52

53
  /**
54
   * @return {@code true} if files and folders shall be copied recursively, {@code false} otherwise ({@link #isFileOnly() copy file copy}).
55
   */
56
  public boolean isRecursive() {
57

58
    return !isFileOnly();
×
59
  }
60

61
  /**
62
   * @return {@code true} to fail if the target file or folder already exists, {@code false} otherwise.
63
   */
64
  public boolean isFailIfExists() {
65

66
    return Boolean.FALSE.equals(this.override);
5✔
67
  }
68

69
  /**
70
   * @return {@code true} to override existing files and merge existing directories, {@code false} otherwise.
71
   */
72
  public boolean isOverride() {
73

74
    return Boolean.TRUE.equals(this.override);
5✔
75
  }
76

77
  /**
78
   * @return {@code true} if we copy from a virtual filesystem of a compressed archive.
79
   */
80
  public boolean isExtract() {
81

82
    return (this == EXTRACT);
7✔
83
  }
84

85
  /**
86
   * @return the name of the operation (typically "copy" but may also be e.g. "extract").
87
   */
88
  public String getOperation() {
89

90
    if (isExtract()) {
3✔
91
      return "extract";
2✔
92
    }
93
    return "copy";
2✔
94
  }
95

96
  /**
97
   * @return {@code true} to copy to the target as directory with the source filename appended, {@code false} copy to the target as given.
98
   */
99
  public boolean isUseSourceFilename() {
100

101
    return this.useSourceFilename;
3✔
102
  }
103
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc