Skip to content

Commit 5a59d9a

Browse files
committed
test(rds): address review findings for query handler tests
Drop mock-maker-subclass config that broke InitializationHooksRunnerTest (Mockito inline mock-maker is the correct default for Java 25 final class mocking). Fix unknownEngine test to verify the realistic error path: handler defaults version to "1.0" for unknown engines, service rejects with InvalidParameterValue, handler wraps into 400 query error. Full suite 1842/0 green (clean build).
1 parent 1af8fc4 commit 5a59d9a

2 files changed

Lines changed: 10 additions & 7 deletions

File tree

src/test/java/io/github/hectorvent/floci/services/rds/RdsQueryHandlerTest.java

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package io.github.hectorvent.floci.services.rds;
22

33
import io.github.hectorvent.floci.config.EmulatorConfig;
4+
import io.github.hectorvent.floci.core.common.AwsException;
45
import io.github.hectorvent.floci.services.rds.model.DbCluster;
56
import io.github.hectorvent.floci.services.rds.model.DbInstance;
67
import io.github.hectorvent.floci.services.rds.model.DbInstanceStatus;
@@ -163,20 +164,23 @@ void createDbInstance_invalidAllocatedStorageFallsBackToDefaultAndEngineVersionD
163164
}
164165

165166
@Test
166-
void createDbInstance_unknownEngineGetsGenericDefaultVersion() {
167-
DbInstance instance = makeInstance("mydb");
167+
void createDbInstance_unknownEngineReturnsInvalidParameterValue() {
168+
// Handler defaults version to "1.0" for unknown engines, then the service
169+
// rejects the engine. Verify the full error path: version defaulting +
170+
// AwsException wrapping into a 400 query error.
168171
when(service.createDbInstance(eq("mydb"), eq("oracle"), eq("1.0"),
169172
eq(null), eq(null), eq(null), eq("db.t3.micro"),
170173
eq(20), eq(false), eq(null), eq(null)))
171-
.thenReturn(instance);
174+
.thenThrow(new AwsException("InvalidParameterValue",
175+
"Unsupported engine: oracle. Supported: postgres, mysql, mariadb.", 400));
172176

173177
MultivaluedMap<String, String> p = params();
174178
p.add("DBInstanceIdentifier", "mydb");
175179
p.add("Engine", "oracle");
176-
handler.handle("CreateDBInstance", p);
180+
Response response = handler.handle("CreateDBInstance", p);
177181

178-
verify(service).createDbInstance("mydb", "oracle", "1.0",
179-
null, null, null, "db.t3.micro", 20, false, null, null);
182+
assertEquals(400, response.getStatus());
183+
assertTrue(((String) response.getEntity()).contains("InvalidParameterValue"));
180184
}
181185

182186
@Test

src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)