diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 00000000..c39d4cf2 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,15 @@ +// .devcontainer/devcontainer.json +{ + "name": "Java", + "image": "mcr.microsoft.com/devcontainers/java", + "customizations": { + "vscode": { + "settings": { + "terminal.integrated.shell.linux": "/bin/bash" + } + }, + "extensions": [ + "vscjava.vscode-java-pack" + ] + } +} \ No newline at end of file diff --git a/.github/workflows/auto-merge-dependabot-pr.yml b/.github/workflows/auto-merge-dependabot-pr.yml index 4d59f161..dcddf345 100644 --- a/.github/workflows/auto-merge-dependabot-pr.yml +++ b/.github/workflows/auto-merge-dependabot-pr.yml @@ -5,19 +5,21 @@ on: - opened - synchronize -permissions: - contents: write - pull-requests: write - jobs: tests: uses: ./.github/workflows/test.yml secrets: inherit - + permissions: + contents: read + dependabot: name: Auto-merge Dependabot PR runs-on: ${{ vars.RTLDEV_MW_CI_OS }} needs: tests + permissions: + contents: write + pull-requests: write + if: ${{ github.actor == 'dependabot[bot]' }} steps: - name: Dependabot metadata diff --git a/pom.xml b/pom.xml index 812db2e7..4fcd35b2 100644 --- a/pom.xml +++ b/pom.xml @@ -70,7 +70,6 @@ 3.6.2 true - 8 -html5 @@ -123,6 +122,11 @@ maven-install-plugin 3.1.1 + + org.apache.maven.plugins + maven-project-info-reports-plugin + 3.4.5 + org.apache.maven.plugins maven-release-plugin diff --git a/src/main/java/net/hexonet/apiconnector/Response.java b/src/main/java/net/hexonet/apiconnector/Response.java index c6fe4584..cffa83b3 100644 --- a/src/main/java/net/hexonet/apiconnector/Response.java +++ b/src/main/java/net/hexonet/apiconnector/Response.java @@ -3,6 +3,7 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; +import java.util.List; import java.util.Map; /** @@ -303,13 +304,13 @@ public Map getCommand() { */ public String getCommandPlain() { StringBuilder tmp = new StringBuilder(""); - Iterator> it = this.command.entrySet().iterator(); - while (it.hasNext()) { - Map.Entry pair = it.next(); - tmp.append(pair.getKey()); - tmp.append(" = "); - tmp.append(pair.getValue()); - tmp.append("\n"); + List> sortedEntries = new ArrayList<>(this.command.entrySet()); + sortedEntries.sort(Map.Entry.comparingByKey()); + for (Map.Entry pair : sortedEntries) { + tmp.append(pair.getKey()) + .append(" = ") + .append(pair.getValue()) + .append("\n"); } return tmp.toString(); } @@ -625,4 +626,4 @@ private boolean hasNextRecord() { private boolean hasPreviousRecord() { return (this.recordIndex > 0 && this.hasCurrentRecord()); } -} +} \ No newline at end of file diff --git a/src/test/java/net/hexonet/apiconnector/ResponseTest.java b/src/test/java/net/hexonet/apiconnector/ResponseTest.java index 5be2ef2a..cffe98df 100644 --- a/src/test/java/net/hexonet/apiconnector/ResponseTest.java +++ b/src/test/java/net/hexonet/apiconnector/ResponseTest.java @@ -108,7 +108,7 @@ public void getCommandPlainSecure() { cmd.put("SUBUSER", "test.user"); cmd.put("PASSWORD", "test.passw0rd"); Response r = new Response("", cmd); - String str = "SUBUSER = test.user\nCOMMAND = CheckAuthentication\nPASSWORD = ***\n"; + String str = "COMMAND = CheckAuthentication\nPASSWORD = ***\nSUBUSER = test.user\n"; assertEquals(str, r.getCommandPlain()); }