Fix case insensitive bug #1
17
.github/workflows/ci.yml
vendored
17
.github/workflows/ci.yml
vendored
@ -13,24 +13,17 @@ jobs:
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Set up JDK 21
|
||||
uses: actions/setup-java@v3
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
java-version: '21'
|
||||
distribution: 'temurin'
|
||||
|
||||
- name: Cache Maven packages
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: ~/.m2
|
||||
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-maven-
|
||||
cache: 'maven'
|
||||
|
||||
- name: Build with Maven
|
||||
run: mvn clean install
|
||||
run: ./mvnw clean verify
|
||||
|
||||
- name: Run tests
|
||||
run: mvn test
|
||||
run: ./mvnw test
|
||||
|
||||
- name: Run Checkstyle
|
||||
run: mvn checkstyle:check
|
||||
run: ./mvnw checkstyle:check
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package dsv.su.apimposter.service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
@ -93,10 +94,18 @@ public class MockService {
|
||||
if (expected == null) return true; // No condition defined — pass
|
||||
if (actual == null) return false;
|
||||
|
||||
Map<String, String> lowerCasedActual = new HashMap<>();
|
||||
for (Map.Entry<String, String> entry : actual.entrySet()) {
|
||||
lowerCasedActual.put(entry.getKey().toLowerCase(Locale.ROOT), entry.getValue());
|
||||
}
|
||||
|
||||
for (Map.Entry<String, String> entry : expected.entrySet()) {
|
||||
String key = entry.getKey().toLowerCase(Locale.ROOT);
|
||||
String value = entry.getValue();
|
||||
if (!value.equals(actual.get(key))) return false;
|
||||
String expectedKey = entry.getKey().toLowerCase(Locale.ROOT);
|
||||
String expectedValue = entry.getValue();
|
||||
|
||||
if (!expectedValue.equals(lowerCasedActual.get(expectedKey))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user