diff --git a/core/store/src/test/java/uk/gov/gchq/gaffer/store/StoreTest.java b/core/store/src/test/java/uk/gov/gchq/gaffer/store/StoreTest.java index b43a7e379b9..11abf7becac 100644 --- a/core/store/src/test/java/uk/gov/gchq/gaffer/store/StoreTest.java +++ b/core/store/src/test/java/uk/gov/gchq/gaffer/store/StoreTest.java @@ -170,6 +170,7 @@ import static org.mockito.Mockito.never; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyNoInteractions; import static uk.gov.gchq.gaffer.jobtracker.JobTracker.JOB_TRACKER_CACHE_SERVICE_NAME; import static uk.gov.gchq.gaffer.store.StoreTrait.INGEST_AGGREGATION; import static uk.gov.gchq.gaffer.store.StoreTrait.ORDERED; @@ -257,29 +258,21 @@ public void after() { } @Test - public void shouldExecuteOperationWhenJobTrackerCacheIsBroken(@Mock final StoreProperties storeProperties) throws Exception { + public void shouldNotCreateJobWhenExecutingOperation(@Mock final StoreProperties storeProperties) throws Exception { // Given ICache mockICache = Mockito.mock(ICache.class); - doThrow(new CacheOperationException("Stubbed class")).when(mockICache).put(any(), any()); ICacheService mockICacheService = Mockito.spy(ICacheService.class); - given(mockICacheService.getCache(any())).willReturn(mockICache); - - Field field = CacheServiceLoader.class.getDeclaredField("SERVICES"); - field.setAccessible(true); - java.util.Map mockCacheServices = (java.util.Map) field.get(new HashMap<>()); - mockCacheServices.put(JOB_TRACKER_CACHE_SERVICE_NAME, mockICacheService); final AddElements addElements = new AddElements(); final StoreImpl3 store = new StoreImpl3(); store.initialise("graphId", createSchemaMock(), storeProperties); // When - store.executeJob(addElements, context); + store.execute(addElements, context); // Then verify(addElementsHandler).doOperation(addElements, context, store); - verify(mockICacheService, Mockito.atLeast(1)).getCache(any()); - verify(mockICache, Mockito.atLeast(1)).put(any(), any()); + verifyNoInteractions(mockICacheService, mockICache); } @Test diff --git a/rest-api/core-rest/src/test/java/uk/gov/gchq/gaffer/rest/service/v2/OperationServiceV2IT.java b/rest-api/core-rest/src/test/java/uk/gov/gchq/gaffer/rest/service/v2/OperationServiceV2IT.java index d656eebbae9..85980767986 100644 --- a/rest-api/core-rest/src/test/java/uk/gov/gchq/gaffer/rest/service/v2/OperationServiceV2IT.java +++ b/rest-api/core-rest/src/test/java/uk/gov/gchq/gaffer/rest/service/v2/OperationServiceV2IT.java @@ -56,7 +56,7 @@ public class OperationServiceV2IT extends OperationServiceIT { @Test - void shouldReturnNotJobIdHeader() throws IOException { + void shouldNotReturnJobIdHeader() throws IOException { // When final Response response = client.executeOperation(new GetAllElements()); diff --git a/rest-api/spring-rest/src/test/java/uk/gov/gchq/gaffer/rest/integration/controller/OperationControllerIT.java b/rest-api/spring-rest/src/test/java/uk/gov/gchq/gaffer/rest/integration/controller/OperationControllerIT.java index 4df90bdf40f..fb7ec4f0fcb 100644 --- a/rest-api/spring-rest/src/test/java/uk/gov/gchq/gaffer/rest/integration/controller/OperationControllerIT.java +++ b/rest-api/spring-rest/src/test/java/uk/gov/gchq/gaffer/rest/integration/controller/OperationControllerIT.java @@ -1,5 +1,5 @@ /* - * Copyright 2020-2024 Crown Copyright + * Copyright 2020-2025 Crown Copyright * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License.