Skip to content

Commit a5e0fe7

Browse files
committed
remove underscores from test names
1 parent d38eafd commit a5e0fe7

6 files changed

Lines changed: 49 additions & 63 deletions

File tree

src/test/java/de/codebarista/shopware/appserver/AppLookupServiceErrorTest.java

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -30,28 +30,28 @@ public void setup() {
3030
}
3131

3232
@Test
33-
public void getAppByKey_withNonExistentKey_throwsNoSuchAppException() {
33+
public void getAppByKeyWithNonExistentKeyThrows() {
3434
assertThatThrownBy(() -> appLookupService.getAppByKey("nonexistent"))
3535
.isInstanceOf(NoSuchAppException.class)
3636
.hasMessage("No such app nonexistent");
3737
}
3838

3939
@Test
40-
public void getAppByKey_withNullKey_throwsNoSuchAppException() {
40+
public void getAppByKeyWithNullKeyThrows() {
4141
assertThatThrownBy(() -> appLookupService.getAppByKey(null))
4242
.isInstanceOf(NoSuchAppException.class)
4343
.hasMessage("No such app null");
4444
}
4545

4646
@Test
47-
public void getAppByKey_withEmptyKey_throwsNoSuchAppException() {
47+
public void getAppByKeyWithEmptyKeyThrows() {
4848
assertThatThrownBy(() -> appLookupService.getAppByKey(""))
4949
.isInstanceOf(NoSuchAppException.class)
5050
.hasMessage("No such app ");
5151
}
5252

5353
@Test
54-
public void getAppByKey_withValidKey_returnsCorrectApp() {
54+
public void getAppByKeyWithValidKeyReturnsCorrectApp() {
5555
ShopwareApp result = appLookupService.getAppByKey(testAppA.getAppKey());
5656
assertThat(result).isEqualTo(testAppA);
5757

@@ -60,52 +60,52 @@ public void getAppByKey_withValidKey_returnsCorrectApp() {
6060
}
6161

6262
@Test
63-
public void getAppForHost_withNonExistentHost_throwsNoSuchAppException() {
63+
public void getAppForHostWithNonExistentHostThrows() {
6464
// This should extract subdomain and then fail to find app
6565
assertThatThrownBy(() -> appLookupService.getAppForHost("nonexistent.example.com"))
6666
.isInstanceOf(NoSuchAppException.class)
6767
.hasMessage("No such app nonexistent");
6868
}
6969

7070
@Test
71-
public void getAppForHost_withValidHost_returnsCorrectApp() {
71+
public void getAppForHostWithValidHostReturnsCorrectApp() {
7272
// Assuming testAppA has appKey that matches subdomain
7373
String hostWithAppKey = testAppA.getAppKey() + ".example.com";
7474
ShopwareApp result = appLookupService.getAppForHost(hostWithAppKey);
7575
assertThat(result).isEqualTo(testAppA);
7676
}
7777

7878
@Test
79-
public void tryGetForHost_withNonExistentHost_returnsNull() {
79+
public void tryGetForHostWithNonExistentHostReturnsNull() {
8080
// tryGetForHost should return null instead of throwing
8181
ShopwareApp result = appLookupService.tryGetForHost("nonexistent.example.com");
8282
assertThat(result).isNull();
8383
}
8484

8585
@Test
86-
public void tryGetForHost_withNullHost_returnsNull() {
86+
public void tryGetForHostWithNullHostReturnsNull() {
8787
// tryGetForHost should handle null gracefully
8888
ShopwareApp result = appLookupService.tryGetForHost(null);
8989
assertThat(result).isNull();
9090
}
9191

9292
@Test
93-
public void tryGetForHost_withInvalidHost_returnsNull() {
93+
public void tryGetForHostWithInvalidHostReturnsNull() {
9494
// Hosts without dots should return null
9595
assertThat(appLookupService.tryGetForHost("localhost")).isNull();
9696
assertThat(appLookupService.tryGetForHost("")).isNull();
9797
assertThat(appLookupService.tryGetForHost("nodots")).isNull();
9898
}
9999

100100
@Test
101-
public void tryGetForHost_withValidHost_returnsCorrectApp() {
101+
public void tryGetForHostWithValidHostReturnsCorrectApp() {
102102
String hostWithAppKey = testAppA.getAppKey() + ".example.com";
103103
ShopwareApp result = appLookupService.tryGetForHost(hostWithAppKey);
104104
assertThat(result).isEqualTo(testAppA);
105105
}
106106

107107
@Test
108-
public void getAppByKey_isCaseSensitive() {
108+
public void getAppByKeyIsCaseSensitive() {
109109
String upperCaseKey = testAppA.getAppKey().toUpperCase();
110110

111111
// Should throw exception because keys are case sensitive
@@ -114,22 +114,22 @@ public void getAppByKey_isCaseSensitive() {
114114
}
115115

116116
@Test
117-
public void tryGetForHost_withSubdomainOnly_worksCorrectly() {
117+
public void tryGetForHostWithSubdomainOnly() {
118118
// Test edge case where host is just subdomain + domain
119119
String minimalHost = testAppA.getAppKey() + ".com";
120120
ShopwareApp result = appLookupService.tryGetForHost(minimalHost);
121121
assertThat(result).isEqualTo(testAppA);
122122
}
123123

124124
@Test
125-
public void tryGetForHost_withEmptySubdomain_returnsNull() {
125+
public void tryGetForHostWithEmptySubdomainReturnsNull() {
126126
// Host starting with dot should have empty subdomain
127127
ShopwareApp result = appLookupService.tryGetForHost(".example.com");
128128
assertThat(result).isNull();
129129
}
130130

131131
@Test
132-
public void tryGetForHost_withComplexSubdomain_extractsCorrectly() {
132+
public void tryGetForHostWithComplexSubdomain_extractsCorrectly() {
133133
// Should only extract the first part before the first dot
134134
String complexHost = testAppA.getAppKey() + ".sub.domain.example.com";
135135
ShopwareApp result = appLookupService.tryGetForHost(complexHost);

src/test/java/de/codebarista/shopware/appserver/LifecycleEventApiTest.java

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -27,21 +27,6 @@ public class LifecycleEventApiTest {
2727
@Autowired
2828
private ShopwareShopEntityRepository shopwareShopEntityRepository;
2929

30-
@Test
31-
public void testActivated() {
32-
// TODO: implement. Event not yet used.
33-
}
34-
35-
@Test
36-
public void testDeactivated() {
37-
// TODO: implement. Event not yet used.
38-
}
39-
40-
@Test
41-
public void testUpdated() {
42-
// TODO: implement. Event not yet used.
43-
}
44-
4530
@Test
4631
@Sql("/insert_testshop_for_testapp_a.sql")
4732
public void successfullyDeleteShop() {

src/test/java/de/codebarista/shopware/appserver/SignatureServiceErrorTest.java

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package de.codebarista.shopware.appserver;
22

33
import com.fasterxml.jackson.databind.ObjectMapper;
4+
45
import de.codebarista.shopware.appserver.exception.InvalidSignatureException;
56
import de.codebarista.shopware.appserver.service.SignatureService;
67
import org.junit.jupiter.api.BeforeEach;
@@ -22,50 +23,50 @@ public void setup() {
2223
}
2324

2425
@Test
25-
public void calculateSignature_withNullData_throwsInvalidSignatureException() {
26+
public void calculateSignatureWithNullDataFails() {
2627
assertThatThrownBy(() -> signatureService.calculateSignature(null, "secret"))
2728
.isInstanceOf(InvalidSignatureException.class)
2829
.hasMessage("Data or secret cannot be null");
2930
}
3031

3132
@Test
32-
public void calculateSignature_withNullSecret_throwsInvalidSignatureException() {
33+
public void calculateSignatureWithNullSecretFails() {
3334
assertThatThrownBy(() -> signatureService.calculateSignature("data", null))
3435
.isInstanceOf(InvalidSignatureException.class)
3536
.hasMessage("Data or secret cannot be null");
3637
}
3738

3839
@Test
39-
public void calculateSignature_withBothNull_throwsInvalidSignatureException() {
40+
public void calculateSignatureWithBothNullFails() {
4041
assertThatThrownBy(() -> signatureService.calculateSignature(null, null))
4142
.isInstanceOf(InvalidSignatureException.class)
4243
.hasMessage("Data or secret cannot be null");
4344
}
4445

4546
@Test
46-
public void serializeAndCalculateSignature_withNullData_throwsInvalidSignatureException() {
47+
public void serializeAndCalculateSignatureWithNullDataFails() {
4748
assertThatThrownBy(() -> signatureService.serializeAndCalculateSignature(null, "secret"))
4849
.isInstanceOf(InvalidSignatureException.class)
4950
.hasMessage("Data or secret cannot be null");
5051
}
5152

5253
@Test
53-
public void serializeAndCalculateSignature_withNullSecret_throwsInvalidSignatureException() {
54+
public void serializeAndCalculateSignatureWithNullSecretFails() {
5455
Object data = new TestData("test");
5556
assertThatThrownBy(() -> signatureService.serializeAndCalculateSignature(data, null))
5657
.isInstanceOf(InvalidSignatureException.class)
5758
.hasMessage("Data or secret cannot be null");
5859
}
5960

6061
@Test
61-
public void hash_withNullData_throwsInvalidSignatureException() {
62+
public void hashWithNullDataFails() {
6263
assertThatThrownBy(() -> signatureService.hash(null))
6364
.isInstanceOf(InvalidSignatureException.class)
6465
.hasMessage("Data to hash cannot be null");
6566
}
6667

6768
@Test
68-
public void verifySignature_withNullInputs_returnsFalseGracefully() {
69+
public void verifySignatureWithNullInputsReturnsFalseGracefully() {
6970
// These should return false instead of throwing exceptions
7071
assertThat(signatureService.verifySignature(null, "secret", "signature")).isFalse();
7172
assertThat(signatureService.verifySignature("data".getBytes(), null, "signature")).isFalse();
@@ -74,7 +75,7 @@ public void verifySignature_withNullInputs_returnsFalseGracefully() {
7475
}
7576

7677
@Test
77-
public void verifySignature_withInvalidSignature_returnsFalse() {
78+
public void verifySignatureWithInvalidSignatureReturnsFalse() {
7879
String data = "test data";
7980
String secret = "test secret";
8081
String invalidSignature = "invalid_signature";
@@ -83,36 +84,36 @@ public void verifySignature_withInvalidSignature_returnsFalse() {
8384
}
8485

8586
@Test
86-
public void verifySignature_withEmptyInputs_returnsFalse() {
87+
public void verifySignatureWithEmptyInputsReturnsFalse() {
8788
// Empty secret causes IllegalArgumentException in HMAC, so this should return false gracefully
8889
assertThat(signatureService.verifySignature("data".getBytes(), "", "signature")).isFalse();
8990
assertThat(signatureService.verifySignature(new byte[0], "secret", "signature")).isFalse();
9091
}
9192

9293
@Test
93-
public void calculateSignature_withEmptyData_worksCorrectly() {
94+
public void calculateSignatureWithEmptyData() {
9495
// Empty data should work with valid secret
9596
String result = signatureService.calculateSignature("", "secret");
9697
assertThat(result).isNotNull().isNotEmpty();
9798
}
9899

99100
@Test
100-
public void calculateSignature_withEmptySecret_throwsInvalidSignatureException() {
101+
public void calculateSignatureWithEmptySecretFails() {
101102
// Empty secret should throw exception due to HMAC requirements
102103
assertThatThrownBy(() -> signatureService.calculateSignature("data", ""))
103104
.isInstanceOf(InvalidSignatureException.class)
104105
.hasMessage("Could not calculate signature");
105106
}
106107

107108
@Test
108-
public void hash_withEmptyString_worksCorrectly() {
109+
public void hashWithEmptyString() {
109110
// Empty string should work (not null)
110111
String result = signatureService.hash("");
111112
assertThat(result).isNotNull().isNotEmpty();
112113
}
113114

114115
@Test
115-
public void calculateSignature_withVeryLongInputs_worksCorrectly() {
116+
public void calculateSignatureWithVeryLongInputs() {
116117
String longData = "x".repeat(10000);
117118
String longSecret = "s".repeat(1000);
118119

@@ -121,7 +122,7 @@ public void calculateSignature_withVeryLongInputs_worksCorrectly() {
121122
}
122123

123124
@Test
124-
public void hash_withUnicodeCharacters_worksCorrectly() {
125+
public void hashWithUnicodeCharacters() {
125126
String unicodeData = "Hello 世界 🌍 émojis";
126127

127128
String result = signatureService.hash(unicodeData);

src/test/java/de/codebarista/shopware/appserver/SignatureServiceTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public static void setup() {
1919
}
2020

2121
@Test
22-
public void testCalculateSignature() {
22+
public void calculateSignature() {
2323
String shopId = "zYh6GeKt5VK3UhU5";
2424
String shopUrl = "http://127.0.0.1:8000";
2525
String appName = "BaristaUploadApp";
@@ -32,7 +32,7 @@ public void testCalculateSignature() {
3232
}
3333

3434
@Test
35-
public void testVerifySignature() {
35+
public void verifySignature() {
3636
String shopwareShopSignature = "cc7fa4fb23901eacc5c68ee5a55ca74d1c71264390d7b49c1d86836c039a12c4";
3737
String query = "shop-id=zYh6GeKt5VK3UhU5&shop-url=http://localhost:8000&timestamp=1703088642"
3838
+ "&sw-version=6.5.7.3&sw-context-language=2fbb5fe2e29a4d70aa5854ce7ce3e20b"

src/test/java/de/codebarista/shopware/appserver/SqliteConfigurationTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ class SqliteConfigurationTest {
1818
private JdbcTemplate jdbcTemplate;
1919

2020
@Test
21-
void testSqliteForEnabledForeignKeySupport() {
21+
void sqliteForEnabledForeignKeySupport() {
2222
Integer result = jdbcTemplate.queryForObject("PRAGMA foreign_keys", Integer.class);
2323
assertThat(result).isEqualTo(1);
2424
}
2525

2626
@Test
27-
void testSqliteForBusyTimeout() {
27+
void sqliteForBusyTimeout() {
2828
Integer result = jdbcTemplate.queryForObject("PRAGMA busy_timeout", Integer.class);
2929
assertThat(result).isEqualTo(5000);
3030
}

0 commit comments

Comments
 (0)