Skip to content

Commit

Permalink
Fix UT
Browse files Browse the repository at this point in the history
  • Loading branch information
gnodet committed Feb 11, 2025
1 parent d28fcfb commit 098a0e4
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,14 @@
*/
package org.apache.maven.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.concurrent.ConcurrentHashMap;

import org.apache.maven.api.Project;
import org.apache.maven.api.Session;
import org.apache.maven.api.SessionData;
import org.apache.maven.api.Toolchain;
import org.apache.maven.api.services.Lookup;
import org.apache.maven.api.services.ToolchainFactory;
Expand Down Expand Up @@ -88,11 +89,13 @@ void getToolchains_WithInvalidType() {

@Test
void storeAndRetrieveToolchainFromBuildContext() {
Map<String, Object> context = new HashMap<>();
Map<String, Object> context = new ConcurrentHashMap<>();
SessionData data = mock(SessionData.class);
toolchainModel = ToolchainModel.newBuilder().type("jdk").build();
when(session.getService(Lookup.class)).thenReturn(lookup);
when(lookup.lookupOptional(Project.class)).thenReturn(Optional.of(project));
when(session.getPluginContext(project)).thenReturn(context);
when(session.getData()).thenReturn(data);
when(data.computeIfAbsent(any(), any())).thenReturn(context);
when(mockToolchain.getType()).thenReturn("jdk");
when(mockToolchain.getModel()).thenReturn(toolchainModel);
when(jdkFactory.createToolchain(any(ToolchainModel.class))).thenReturn(mockToolchain);
Expand Down

0 comments on commit 098a0e4

Please sign in to comment.