prowide/prowide-core

View on GitHub
src/test/java/com/prowidesoftware/swift/io/parser/MT103ParserTest.java

Summary

Maintainability
F
4 days
Test Coverage

File MT103ParserTest.java has 412 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*
 * Copyright 2006-2023 Prowide
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.

    Method test103_3 has 61 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        @Test
        public void test103_3() {
            messageToParse =
                    "{1:F01FOOBARYYAXXX1234123456}{2:O1030954060228RRRRESMMAXXX55549966520602280954N}{3:{113:NOMT}{108:2006022800940029}{119:STP}}{4:\n"
                            + ":20:B185008345547244\n"

      Method test103_4 has 57 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          @Test
          public void test103_4() {
              messageToParse =
                      "{1:F01FOOBARYYAXXX1234123456}{2:O1031101051102UUUUESMMAXXX54267818770511021101N}{3:{113:ROMF}{108:0511029000000056}}{4:\n"
                              + ":20:0511029000000056\n"

        Method test103_6 has 54 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            @Test
            public void test103_6() {
                messageToParse =
                        "{1:F01FOOBARYYAXXX1234123456}{2:O1031101051102KKKKESMMAXXX54267818770511021101N}{3:{113:ROMF}{108:0511029000000056}}{4:\n"
                                + ":20:0511029000000056\n"

          Method test103_5 has 53 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              @Test
              public void test103_5() {
                  messageToParse =
                          "{1:F01FOOBARYYAXXX1234123456}{2:O1031101051102KKKKESMMAXXX54267818770511021101N}{3:{113:ROMF}{108:0511029000000056}}{4:\n"
                                  + ":20:0511029000000056\n"

            Method test103_1 has 53 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                @Test
                public void test103_1() {
                    messageToParse =
                            "{1:F01FOOBARYYAXXX1234123456}{2:O1030803051028AAPBESMMAXXX54237368560510280803N}{3:{113:NOMF}{108:0510280086100057}{119:STP}}{4:\n"
                                    + ":20:D051026EUR100057\n"

              Method test103_2 has 43 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  @Test
                  public void test103_2() {
                      messageToParse =
                              "{1:F01FOOBARXXAXXX1234123456}{2:O1031041060411AAABESMMAXXX55944670160604111041N}{3:{113:ROMF}{108:0604113641000001}{119:STP}}{4:\n"
                                      + ":20:1234123421340001\n"

                Method test103_8 has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    @Test
                    public void test103_8() {
                        messageToParse =
                                "{1:F01FOOBARYYAXXX1234123456}{2:O1030803051028AAPBESMMAXXX54237368560510280803N}{3:{113:NOMF}{108:0510280086100057}{119:STP}}{4:\n"
                                        + ":20:Return A\n"

                  Define a constant instead of duplicating this literal ":57A:FOOBARYYXXX " 5 times.
                  Open

                                          + ":57A:FOOBARYYXXX\n"

                  Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                  On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                  Noncompliant Code Example

                  With the default threshold of 3:

                  public void run() {
                    prepare("action1");                              // Noncompliant - "action1" is duplicated 3 times
                    execute("action1");
                    release("action1");
                  }
                  
                  @SuppressWarning("all")                            // Compliant - annotations are excluded
                  private void method1() { /* ... */ }
                  @SuppressWarning("all")
                  private void method2() { /* ... */ }
                  
                  public String method3(String a) {
                    System.out.println("'" + a + "'");               // Compliant - literal "'" has less than 5 characters and is excluded
                    return "";                                       // Compliant - literal "" has less than 5 characters and is excluded
                  }
                  

                  Compliant Solution

                  private static final String ACTION_1 = "action1";  // Compliant
                  
                  public void run() {
                    prepare(ACTION_1);                               // Compliant
                    execute(ACTION_1);
                    release(ACTION_1);
                  }
                  

                  Exceptions

                  To prevent generating some false-positives, literals having less than 5 characters are excluded.

                  Define a constant instead of duplicating this literal "MADRID " 3 times.
                  Open

                                          + "MADRID\n"

                  Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                  On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                  Noncompliant Code Example

                  With the default threshold of 3:

                  public void run() {
                    prepare("action1");                              // Noncompliant - "action1" is duplicated 3 times
                    execute("action1");
                    release("action1");
                  }
                  
                  @SuppressWarning("all")                            // Compliant - annotations are excluded
                  private void method1() { /* ... */ }
                  @SuppressWarning("all")
                  private void method2() { /* ... */ }
                  
                  public String method3(String a) {
                    System.out.println("'" + a + "'");               // Compliant - literal "'" has less than 5 characters and is excluded
                    return "";                                       // Compliant - literal "" has less than 5 characters and is excluded
                  }
                  

                  Compliant Solution

                  private static final String ACTION_1 = "action1";  // Compliant
                  
                  public void run() {
                    prepare(ACTION_1);                               // Compliant
                    execute(ACTION_1);
                    release(ACTION_1);
                  }
                  

                  Exceptions

                  To prevent generating some false-positives, literals having less than 5 characters are excluded.

                  Define a constant instead of duplicating this literal "F01FOOBARYYAXXX1234123456" 6 times.
                  Open

                          assertEquals("F01FOOBARYYAXXX1234123456", b1.getBlockValue());

                  Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                  On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                  Noncompliant Code Example

                  With the default threshold of 3:

                  public void run() {
                    prepare("action1");                              // Noncompliant - "action1" is duplicated 3 times
                    execute("action1");
                    release("action1");
                  }
                  
                  @SuppressWarning("all")                            // Compliant - annotations are excluded
                  private void method1() { /* ... */ }
                  @SuppressWarning("all")
                  private void method2() { /* ... */ }
                  
                  public String method3(String a) {
                    System.out.println("'" + a + "'");               // Compliant - literal "'" has less than 5 characters and is excluded
                    return "";                                       // Compliant - literal "" has less than 5 characters and is excluded
                  }
                  

                  Compliant Solution

                  private static final String ACTION_1 = "action1";  // Compliant
                  
                  public void run() {
                    prepare(ACTION_1);                               // Compliant
                    execute(ACTION_1);
                    release(ACTION_1);
                  }
                  

                  Exceptions

                  To prevent generating some false-positives, literals having less than 5 characters are excluded.

                  Define a constant instead of duplicating this literal "//NIMIENTO EQUIPOS E UUUUUUUUUUUUU " 4 times.
                  Open

                                          + "//NIMIENTO EQUIPOS E UUUUUUUUUUUUU\n" + "//TO\n"

                  Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                  On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                  Noncompliant Code Example

                  With the default threshold of 3:

                  public void run() {
                    prepare("action1");                              // Noncompliant - "action1" is duplicated 3 times
                    execute("action1");
                    release("action1");
                  }
                  
                  @SuppressWarning("all")                            // Compliant - annotations are excluded
                  private void method1() { /* ... */ }
                  @SuppressWarning("all")
                  private void method2() { /* ... */ }
                  
                  public String method3(String a) {
                    System.out.println("'" + a + "'");               // Compliant - literal "'" has less than 5 characters and is excluded
                    return "";                                       // Compliant - literal "" has less than 5 characters and is excluded
                  }
                  

                  Compliant Solution

                  private static final String ACTION_1 = "action1";  // Compliant
                  
                  public void run() {
                    prepare(ACTION_1);                               // Compliant
                    execute(ACTION_1);
                    release(ACTION_1);
                  }
                  

                  Exceptions

                  To prevent generating some false-positives, literals having less than 5 characters are excluded.

                  Define a constant instead of duplicating this literal "/REC/00940001872410904744 " 4 times.
                  Open

                                          + "/REFBEN/000A80960552\n" + "/REC/00940001872410904744\n"

                  Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                  On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                  Noncompliant Code Example

                  With the default threshold of 3:

                  public void run() {
                    prepare("action1");                              // Noncompliant - "action1" is duplicated 3 times
                    execute("action1");
                    release("action1");
                  }
                  
                  @SuppressWarning("all")                            // Compliant - annotations are excluded
                  private void method1() { /* ... */ }
                  @SuppressWarning("all")
                  private void method2() { /* ... */ }
                  
                  public String method3(String a) {
                    System.out.println("'" + a + "'");               // Compliant - literal "'" has less than 5 characters and is excluded
                    return "";                                       // Compliant - literal "" has less than 5 characters and is excluded
                  }
                  

                  Compliant Solution

                  private static final String ACTION_1 = "action1";  // Compliant
                  
                  public void run() {
                    prepare(ACTION_1);                               // Compliant
                    execute(ACTION_1);
                    release(ACTION_1);
                  }
                  

                  Exceptions

                  To prevent generating some false-positives, literals having less than 5 characters are excluded.

                  Define a constant instead of duplicating this literal "FOOBARYYXXX" 4 times.
                  Open

                          assertEquals("FOOBARYYXXX", b4.getTagValue("57A"));

                  Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                  On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                  Noncompliant Code Example

                  With the default threshold of 3:

                  public void run() {
                    prepare("action1");                              // Noncompliant - "action1" is duplicated 3 times
                    execute("action1");
                    release("action1");
                  }
                  
                  @SuppressWarning("all")                            // Compliant - annotations are excluded
                  private void method1() { /* ... */ }
                  @SuppressWarning("all")
                  private void method2() { /* ... */ }
                  
                  public String method3(String a) {
                    System.out.println("'" + a + "'");               // Compliant - literal "'" has less than 5 characters and is excluded
                    return "";                                       // Compliant - literal "" has less than 5 characters and is excluded
                  }
                  

                  Compliant Solution

                  private static final String ACTION_1 = "action1";  // Compliant
                  
                  public void run() {
                    prepare(ACTION_1);                               // Compliant
                    execute(ACTION_1);
                    release(ACTION_1);
                  }
                  

                  Exceptions

                  To prevent generating some false-positives, literals having less than 5 characters are excluded.

                  Define a constant instead of duplicating this literal "{1:F01FOOBARYYAXXX1234123456}{2:O1030803051028AAPBESMMAXXX54237368560510280803N}{3:{113:NOMF}{108:0510280086100057}{119:STP}}{4: " 3 times.
                  Open

                                  "{1:F01FOOBARYYAXXX1234123456}{2:O1030803051028AAPBESMMAXXX54237368560510280803N}{3:{113:NOMF}{108:0510280086100057}{119:STP}}{4:\n"

                  Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                  On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                  Noncompliant Code Example

                  With the default threshold of 3:

                  public void run() {
                    prepare("action1");                              // Noncompliant - "action1" is duplicated 3 times
                    execute("action1");
                    release("action1");
                  }
                  
                  @SuppressWarning("all")                            // Compliant - annotations are excluded
                  private void method1() { /* ... */ }
                  @SuppressWarning("all")
                  private void method2() { /* ... */ }
                  
                  public String method3(String a) {
                    System.out.println("'" + a + "'");               // Compliant - literal "'" has less than 5 characters and is excluded
                    return "";                                       // Compliant - literal "" has less than 5 characters and is excluded
                  }
                  

                  Compliant Solution

                  private static final String ACTION_1 = "action1";  // Compliant
                  
                  public void run() {
                    prepare(ACTION_1);                               // Compliant
                    execute(ACTION_1);
                    release(ACTION_1);
                  }
                  

                  Exceptions

                  To prevent generating some false-positives, literals having less than 5 characters are excluded.

                  Define a constant instead of duplicating this literal "-}{5:{MAC:D9D8FA56}{CHK:46E46A6460F2}}" 3 times.
                  Open

                                          + "-}{5:{MAC:D9D8FA56}{CHK:46E46A6460F2}}";

                  Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                  On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                  Noncompliant Code Example

                  With the default threshold of 3:

                  public void run() {
                    prepare("action1");                              // Noncompliant - "action1" is duplicated 3 times
                    execute("action1");
                    release("action1");
                  }
                  
                  @SuppressWarning("all")                            // Compliant - annotations are excluded
                  private void method1() { /* ... */ }
                  @SuppressWarning("all")
                  private void method2() { /* ... */ }
                  
                  public String method3(String a) {
                    System.out.println("'" + a + "'");               // Compliant - literal "'" has less than 5 characters and is excluded
                    return "";                                       // Compliant - literal "" has less than 5 characters and is excluded
                  }
                  

                  Compliant Solution

                  private static final String ACTION_1 = "action1";  // Compliant
                  
                  public void run() {
                    prepare(ACTION_1);                               // Compliant
                    execute(ACTION_1);
                    release(ACTION_1);
                  }
                  

                  Exceptions

                  To prevent generating some false-positives, literals having less than 5 characters are excluded.

                  Define a constant instead of duplicating this literal ":71A:OUR " 4 times.
                  Open

                                          + ":71A:OUR\n"

                  Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                  On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                  Noncompliant Code Example

                  With the default threshold of 3:

                  public void run() {
                    prepare("action1");                              // Noncompliant - "action1" is duplicated 3 times
                    execute("action1");
                    release("action1");
                  }
                  
                  @SuppressWarning("all")                            // Compliant - annotations are excluded
                  private void method1() { /* ... */ }
                  @SuppressWarning("all")
                  private void method2() { /* ... */ }
                  
                  public String method3(String a) {
                    System.out.println("'" + a + "'");               // Compliant - literal "'" has less than 5 characters and is excluded
                    return "";                                       // Compliant - literal "" has less than 5 characters and is excluded
                  }
                  

                  Compliant Solution

                  private static final String ACTION_1 = "action1";  // Compliant
                  
                  public void run() {
                    prepare(ACTION_1);                               // Compliant
                    execute(ACTION_1);
                    release(ACTION_1);
                  }
                  

                  Exceptions

                  To prevent generating some false-positives, literals having less than 5 characters are excluded.

                  Define a constant instead of duplicating this literal ":23B:CRED " 8 times.
                  Open

                                          + ":23B:CRED\n"

                  Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                  On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                  Noncompliant Code Example

                  With the default threshold of 3:

                  public void run() {
                    prepare("action1");                              // Noncompliant - "action1" is duplicated 3 times
                    execute("action1");
                    release("action1");
                  }
                  
                  @SuppressWarning("all")                            // Compliant - annotations are excluded
                  private void method1() { /* ... */ }
                  @SuppressWarning("all")
                  private void method2() { /* ... */ }
                  
                  public String method3(String a) {
                    System.out.println("'" + a + "'");               // Compliant - literal "'" has less than 5 characters and is excluded
                    return "";                                       // Compliant - literal "" has less than 5 characters and is excluded
                  }
                  

                  Compliant Solution

                  private static final String ACTION_1 = "action1";  // Compliant
                  
                  public void run() {
                    prepare(ACTION_1);                               // Compliant
                    execute(ACTION_1);
                    release(ACTION_1);
                  }
                  

                  Exceptions

                  To prevent generating some false-positives, literals having less than 5 characters are excluded.

                  Define a constant instead of duplicating this literal "/00123456789012345678 " 3 times.
                  Open

                                  "/00123456789012345678\n" + "FOOOOBAR, S.A.\n" + "PS DE YYYYYYYYY 88\n" + "MADRID",

                  Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                  On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                  Noncompliant Code Example

                  With the default threshold of 3:

                  public void run() {
                    prepare("action1");                              // Noncompliant - "action1" is duplicated 3 times
                    execute("action1");
                    release("action1");
                  }
                  
                  @SuppressWarning("all")                            // Compliant - annotations are excluded
                  private void method1() { /* ... */ }
                  @SuppressWarning("all")
                  private void method2() { /* ... */ }
                  
                  public String method3(String a) {
                    System.out.println("'" + a + "'");               // Compliant - literal "'" has less than 5 characters and is excluded
                    return "";                                       // Compliant - literal "" has less than 5 characters and is excluded
                  }
                  

                  Compliant Solution

                  private static final String ACTION_1 = "action1";  // Compliant
                  
                  public void run() {
                    prepare(ACTION_1);                               // Compliant
                    execute(ACTION_1);
                    release(ACTION_1);
                  }
                  

                  Exceptions

                  To prevent generating some false-positives, literals having less than 5 characters are excluded.

                  Define a constant instead of duplicating this literal "802BE35B36EB" 3 times.
                  Open

                          assertEquals("802BE35B36EB", b5.getTagValue("CHK"));

                  Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                  On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                  Noncompliant Code Example

                  With the default threshold of 3:

                  public void run() {
                    prepare("action1");                              // Noncompliant - "action1" is duplicated 3 times
                    execute("action1");
                    release("action1");
                  }
                  
                  @SuppressWarning("all")                            // Compliant - annotations are excluded
                  private void method1() { /* ... */ }
                  @SuppressWarning("all")
                  private void method2() { /* ... */ }
                  
                  public String method3(String a) {
                    System.out.println("'" + a + "'");               // Compliant - literal "'" has less than 5 characters and is excluded
                    return "";                                       // Compliant - literal "" has less than 5 characters and is excluded
                  }
                  

                  Compliant Solution

                  private static final String ACTION_1 = "action1";  // Compliant
                  
                  public void run() {
                    prepare(ACTION_1);                               // Compliant
                    execute(ACTION_1);
                    release(ACTION_1);
                  }
                  

                  Exceptions

                  To prevent generating some false-positives, literals having less than 5 characters are excluded.

                  Define a constant instead of duplicating this literal "/REFBEN/000A80960552 " 4 times.
                  Open

                                          + "/REFBEN/000A80960552\n" + "/REC/00940001872410904744\n"

                  Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                  On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                  Noncompliant Code Example

                  With the default threshold of 3:

                  public void run() {
                    prepare("action1");                              // Noncompliant - "action1" is duplicated 3 times
                    execute("action1");
                    release("action1");
                  }
                  
                  @SuppressWarning("all")                            // Compliant - annotations are excluded
                  private void method1() { /* ... */ }
                  @SuppressWarning("all")
                  private void method2() { /* ... */ }
                  
                  public String method3(String a) {
                    System.out.println("'" + a + "'");               // Compliant - literal "'" has less than 5 characters and is excluded
                    return "";                                       // Compliant - literal "" has less than 5 characters and is excluded
                  }
                  

                  Compliant Solution

                  private static final String ACTION_1 = "action1";  // Compliant
                  
                  public void run() {
                    prepare(ACTION_1);                               // Compliant
                    execute(ACTION_1);
                    release(ACTION_1);
                  }
                  

                  Exceptions

                  To prevent generating some false-positives, literals having less than 5 characters are excluded.

                  Define a constant instead of duplicating this literal "FOOBAR, S.A. " 4 times.
                  Open

                                          + "FOOBAR, S.A.\n"

                  Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                  On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                  Noncompliant Code Example

                  With the default threshold of 3:

                  public void run() {
                    prepare("action1");                              // Noncompliant - "action1" is duplicated 3 times
                    execute("action1");
                    release("action1");
                  }
                  
                  @SuppressWarning("all")                            // Compliant - annotations are excluded
                  private void method1() { /* ... */ }
                  @SuppressWarning("all")
                  private void method2() { /* ... */ }
                  
                  public String method3(String a) {
                    System.out.println("'" + a + "'");               // Compliant - literal "'" has less than 5 characters and is excluded
                    return "";                                       // Compliant - literal "" has less than 5 characters and is excluded
                  }
                  

                  Compliant Solution

                  private static final String ACTION_1 = "action1";  // Compliant
                  
                  public void run() {
                    prepare(ACTION_1);                               // Compliant
                    execute(ACTION_1);
                    release(ACTION_1);
                  }
                  

                  Exceptions

                  To prevent generating some false-positives, literals having less than 5 characters are excluded.

                  Define a constant instead of duplicating this literal "//98) " 4 times.
                  Open

                                          + "//98)\n"

                  Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                  On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                  Noncompliant Code Example

                  With the default threshold of 3:

                  public void run() {
                    prepare("action1");                              // Noncompliant - "action1" is duplicated 3 times
                    execute("action1");
                    release("action1");
                  }
                  
                  @SuppressWarning("all")                            // Compliant - annotations are excluded
                  private void method1() { /* ... */ }
                  @SuppressWarning("all")
                  private void method2() { /* ... */ }
                  
                  public String method3(String a) {
                    System.out.println("'" + a + "'");               // Compliant - literal "'" has less than 5 characters and is excluded
                    return "";                                       // Compliant - literal "" has less than 5 characters and is excluded
                  }
                  

                  Compliant Solution

                  private static final String ACTION_1 = "action1";  // Compliant
                  
                  public void run() {
                    prepare(ACTION_1);                               // Compliant
                    execute(ACTION_1);
                    release(ACTION_1);
                  }
                  

                  Exceptions

                  To prevent generating some false-positives, literals having less than 5 characters are excluded.

                  Define a constant instead of duplicating this literal "-}{5:{MAC:17F13741}{CHK:802BE35B36EB}}" 3 times.
                  Open

                                          + "-}{5:{MAC:17F13741}{CHK:802BE35B36EB}}";

                  Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                  On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                  Noncompliant Code Example

                  With the default threshold of 3:

                  public void run() {
                    prepare("action1");                              // Noncompliant - "action1" is duplicated 3 times
                    execute("action1");
                    release("action1");
                  }
                  
                  @SuppressWarning("all")                            // Compliant - annotations are excluded
                  private void method1() { /* ... */ }
                  @SuppressWarning("all")
                  private void method2() { /* ... */ }
                  
                  public String method3(String a) {
                    System.out.println("'" + a + "'");               // Compliant - literal "'" has less than 5 characters and is excluded
                    return "";                                       // Compliant - literal "" has less than 5 characters and is excluded
                  }
                  

                  Compliant Solution

                  private static final String ACTION_1 = "action1";  // Compliant
                  
                  public void run() {
                    prepare(ACTION_1);                               // Compliant
                    execute(ACTION_1);
                    release(ACTION_1);
                  }
                  

                  Exceptions

                  To prevent generating some false-positives, literals having less than 5 characters are excluded.

                  Define a constant instead of duplicating this literal "//MANT " 6 times.
                  Open

                                          + "//MANT\n"

                  Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                  On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                  Noncompliant Code Example

                  With the default threshold of 3:

                  public void run() {
                    prepare("action1");                              // Noncompliant - "action1" is duplicated 3 times
                    execute("action1");
                    release("action1");
                  }
                  
                  @SuppressWarning("all")                            // Compliant - annotations are excluded
                  private void method1() { /* ... */ }
                  @SuppressWarning("all")
                  private void method2() { /* ... */ }
                  
                  public String method3(String a) {
                    System.out.println("'" + a + "'");               // Compliant - literal "'" has less than 5 characters and is excluded
                    return "";                                       // Compliant - literal "" has less than 5 characters and is excluded
                  }
                  

                  Compliant Solution

                  private static final String ACTION_1 = "action1";  // Compliant
                  
                  public void run() {
                    prepare(ACTION_1);                               // Compliant
                    execute(ACTION_1);
                    release(ACTION_1);
                  }
                  

                  Exceptions

                  To prevent generating some false-positives, literals having less than 5 characters are excluded.

                  Define a constant instead of duplicating this literal ":20:0511029000000056 " 3 times.
                  Open

                                          + ":20:0511029000000056\n"

                  Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                  On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                  Noncompliant Code Example

                  With the default threshold of 3:

                  public void run() {
                    prepare("action1");                              // Noncompliant - "action1" is duplicated 3 times
                    execute("action1");
                    release("action1");
                  }
                  
                  @SuppressWarning("all")                            // Compliant - annotations are excluded
                  private void method1() { /* ... */ }
                  @SuppressWarning("all")
                  private void method2() { /* ... */ }
                  
                  public String method3(String a) {
                    System.out.println("'" + a + "'");               // Compliant - literal "'" has less than 5 characters and is excluded
                    return "";                                       // Compliant - literal "" has less than 5 characters and is excluded
                  }
                  

                  Compliant Solution

                  private static final String ACTION_1 = "action1";  // Compliant
                  
                  public void run() {
                    prepare(ACTION_1);                               // Compliant
                    execute(ACTION_1);
                    release(ACTION_1);
                  }
                  

                  Exceptions

                  To prevent generating some false-positives, literals having less than 5 characters are excluded.

                  Define a constant instead of duplicating this literal ":59:/00123456789012345678 " 3 times.
                  Open

                                          + ":59:/00123456789012345678\n"

                  Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                  On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                  Noncompliant Code Example

                  With the default threshold of 3:

                  public void run() {
                    prepare("action1");                              // Noncompliant - "action1" is duplicated 3 times
                    execute("action1");
                    release("action1");
                  }
                  
                  @SuppressWarning("all")                            // Compliant - annotations are excluded
                  private void method1() { /* ... */ }
                  @SuppressWarning("all")
                  private void method2() { /* ... */ }
                  
                  public String method3(String a) {
                    System.out.println("'" + a + "'");               // Compliant - literal "'" has less than 5 characters and is excluded
                    return "";                                       // Compliant - literal "" has less than 5 characters and is excluded
                  }
                  

                  Compliant Solution

                  private static final String ACTION_1 = "action1";  // Compliant
                  
                  public void run() {
                    prepare(ACTION_1);                               // Compliant
                    execute(ACTION_1);
                    release(ACTION_1);
                  }
                  

                  Exceptions

                  To prevent generating some false-positives, literals having less than 5 characters are excluded.

                  Define a constant instead of duplicating this literal "MADRID" 3 times.
                  Open

                                  "/00123456789012345678\n" + "FOOOOBAR, S.A.\n" + "PS DE YYYYYYYYY 88\n" + "MADRID",

                  Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                  On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                  Noncompliant Code Example

                  With the default threshold of 3:

                  public void run() {
                    prepare("action1");                              // Noncompliant - "action1" is duplicated 3 times
                    execute("action1");
                    release("action1");
                  }
                  
                  @SuppressWarning("all")                            // Compliant - annotations are excluded
                  private void method1() { /* ... */ }
                  @SuppressWarning("all")
                  private void method2() { /* ... */ }
                  
                  public String method3(String a) {
                    System.out.println("'" + a + "'");               // Compliant - literal "'" has less than 5 characters and is excluded
                    return "";                                       // Compliant - literal "" has less than 5 characters and is excluded
                  }
                  

                  Compliant Solution

                  private static final String ACTION_1 = "action1";  // Compliant
                  
                  public void run() {
                    prepare(ACTION_1);                               // Compliant
                    execute(ACTION_1);
                    release(ACTION_1);
                  }
                  

                  Exceptions

                  To prevent generating some false-positives, literals having less than 5 characters are excluded.

                  Define a constant instead of duplicating this literal "ABCEESM1XXX" 3 times.
                  Open

                          assertEquals("ABCEESM1XXX", b4.getTagValue("50A"));

                  Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                  On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                  Noncompliant Code Example

                  With the default threshold of 3:

                  public void run() {
                    prepare("action1");                              // Noncompliant - "action1" is duplicated 3 times
                    execute("action1");
                    release("action1");
                  }
                  
                  @SuppressWarning("all")                            // Compliant - annotations are excluded
                  private void method1() { /* ... */ }
                  @SuppressWarning("all")
                  private void method2() { /* ... */ }
                  
                  public String method3(String a) {
                    System.out.println("'" + a + "'");               // Compliant - literal "'" has less than 5 characters and is excluded
                    return "";                                       // Compliant - literal "" has less than 5 characters and is excluded
                  }
                  

                  Compliant Solution

                  private static final String ACTION_1 = "action1";  // Compliant
                  
                  public void run() {
                    prepare(ACTION_1);                               // Compliant
                    execute(ACTION_1);
                    release(ACTION_1);
                  }
                  

                  Exceptions

                  To prevent generating some false-positives, literals having less than 5 characters are excluded.

                  Define a constant instead of duplicating this literal "17F13741" 3 times.
                  Open

                          assertEquals("17F13741", b5.getTagValue("MAC"));

                  Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                  On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                  Noncompliant Code Example

                  With the default threshold of 3:

                  public void run() {
                    prepare("action1");                              // Noncompliant - "action1" is duplicated 3 times
                    execute("action1");
                    release("action1");
                  }
                  
                  @SuppressWarning("all")                            // Compliant - annotations are excluded
                  private void method1() { /* ... */ }
                  @SuppressWarning("all")
                  private void method2() { /* ... */ }
                  
                  public String method3(String a) {
                    System.out.println("'" + a + "'");               // Compliant - literal "'" has less than 5 characters and is excluded
                    return "";                                       // Compliant - literal "" has less than 5 characters and is excluded
                  }
                  

                  Compliant Solution

                  private static final String ACTION_1 = "action1";  // Compliant
                  
                  public void run() {
                    prepare(ACTION_1);                               // Compliant
                    execute(ACTION_1);
                    release(ACTION_1);
                  }
                  

                  Exceptions

                  To prevent generating some false-positives, literals having less than 5 characters are excluded.

                  Define a constant instead of duplicating this literal "//TO " 3 times.
                  Open

                                          + "//TO\n"

                  Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                  On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                  Noncompliant Code Example

                  With the default threshold of 3:

                  public void run() {
                    prepare("action1");                              // Noncompliant - "action1" is duplicated 3 times
                    execute("action1");
                    release("action1");
                  }
                  
                  @SuppressWarning("all")                            // Compliant - annotations are excluded
                  private void method1() { /* ... */ }
                  @SuppressWarning("all")
                  private void method2() { /* ... */ }
                  
                  public String method3(String a) {
                    System.out.println("'" + a + "'");               // Compliant - literal "'" has less than 5 characters and is excluded
                    return "";                                       // Compliant - literal "" has less than 5 characters and is excluded
                  }
                  

                  Compliant Solution

                  private static final String ACTION_1 = "action1";  // Compliant
                  
                  public void run() {
                    prepare(ACTION_1);                               // Compliant
                    execute(ACTION_1);
                    release(ACTION_1);
                  }
                  

                  Exceptions

                  To prevent generating some false-positives, literals having less than 5 characters are excluded.

                  Define a constant instead of duplicating this literal "PS DE FFFFFFF 66 " 4 times.
                  Open

                                          + "PS DE FFFFFFF 66\n"

                  Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                  On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                  Noncompliant Code Example

                  With the default threshold of 3:

                  public void run() {
                    prepare("action1");                              // Noncompliant - "action1" is duplicated 3 times
                    execute("action1");
                    release("action1");
                  }
                  
                  @SuppressWarning("all")                            // Compliant - annotations are excluded
                  private void method1() { /* ... */ }
                  @SuppressWarning("all")
                  private void method2() { /* ... */ }
                  
                  public String method3(String a) {
                    System.out.println("'" + a + "'");               // Compliant - literal "'" has less than 5 characters and is excluded
                    return "";                                       // Compliant - literal "" has less than 5 characters and is excluded
                  }
                  

                  Compliant Solution

                  private static final String ACTION_1 = "action1";  // Compliant
                  
                  public void run() {
                    prepare(ACTION_1);                               // Compliant
                    execute(ACTION_1);
                    release(ACTION_1);
                  }
                  

                  Exceptions

                  To prevent generating some false-positives, literals having less than 5 characters are excluded.

                  Define a constant instead of duplicating this literal "0511029000000056" 6 times.
                  Open

                          assertEquals("0511029000000056", b3.getTagValue("108"));

                  Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                  On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                  Noncompliant Code Example

                  With the default threshold of 3:

                  public void run() {
                    prepare("action1");                              // Noncompliant - "action1" is duplicated 3 times
                    execute("action1");
                    release("action1");
                  }
                  
                  @SuppressWarning("all")                            // Compliant - annotations are excluded
                  private void method1() { /* ... */ }
                  @SuppressWarning("all")
                  private void method2() { /* ... */ }
                  
                  public String method3(String a) {
                    System.out.println("'" + a + "'");               // Compliant - literal "'" has less than 5 characters and is excluded
                    return "";                                       // Compliant - literal "" has less than 5 characters and is excluded
                  }
                  

                  Compliant Solution

                  private static final String ACTION_1 = "action1";  // Compliant
                  
                  public void run() {
                    prepare(ACTION_1);                               // Compliant
                    execute(ACTION_1);
                    release(ACTION_1);
                  }
                  

                  Exceptions

                  To prevent generating some false-positives, literals having less than 5 characters are excluded.

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                      @Test
                      public void test103_5() {
                          messageToParse =
                                  "{1:F01FOOBARYYAXXX1234123456}{2:O1031101051102KKKKESMMAXXX54267818770511021101N}{3:{113:ROMF}{108:0511029000000056}}{4:\n"
                                          + ":20:0511029000000056\n"
                  src/test/java/com/prowidesoftware/swift/io/parser/MT103ParserTest.java on lines 247..322

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 421.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                      @Test
                      public void test103_4() {
                          messageToParse =
                                  "{1:F01FOOBARYYAXXX1234123456}{2:O1031101051102UUUUESMMAXXX54267818770511021101N}{3:{113:ROMF}{108:0511029000000056}}{4:\n"
                                          + ":20:0511029000000056\n"
                  src/test/java/com/prowidesoftware/swift/io/parser/MT103ParserTest.java on lines 324..395

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 421.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 4 locations. Consider refactoring.
                  Open

                          messageToParse =
                                  "{1:F01FOOBARYYAXXX1234123456}{2:O1030803051028AAPBESMMAXXX54237368560510280803N}{3:{113:NOMF}{108:0510280086100057}{119:STP}}{4:\n"
                                          + ":20:D051026EUR100057\n"
                                          + ":13C:/RNCTIME/0802+0000\n"
                                          + ":23B:CRED\n"
                  src/test/java/com/prowidesoftware/swift/io/parser/MT103ParserTest.java on lines 474..489
                  src/test/java/com/prowidesoftware/swift/io/parser/MT202ParserTest.java on lines 292..307
                  src/test/java/com/prowidesoftware/swift/io/parser/MT900ParserTest.java on lines 31..44

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 64.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 4 locations. Consider refactoring.
                  Open

                          messageToParse =
                                  "{1:F01FOOBARYYAXXX1234123456}{2:O1030803051028AAPBESMMAXXX54237368560510280803N}{3:{113:NOMF}{108:0510280086100057}{119:STP}}{4:\n"
                                          + ":20:D051026EUR100057\n"
                                          + ":13C:/RNCTIME/0802+0000\n"
                                          + ":23B:CRED\n"
                  src/test/java/com/prowidesoftware/swift/io/parser/MT103ParserTest.java on lines 36..51
                  src/test/java/com/prowidesoftware/swift/io/parser/MT202ParserTest.java on lines 292..307
                  src/test/java/com/prowidesoftware/swift/io/parser/MT900ParserTest.java on lines 31..44

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 64.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  There are no issues that match your filters.

                  Category
                  Status