Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix tests
Browse files Browse the repository at this point in the history
tepi committed Jan 17, 2025

Unverified

The email in this signature doesn’t match the committer email.
1 parent 0d19eb1 commit ce90444
Showing 3 changed files with 23 additions and 20 deletions.
Original file line number Diff line number Diff line change
@@ -35,6 +35,7 @@

import com.vaadin.experimental.FeatureFlags;
import com.vaadin.flow.di.Lookup;
import com.vaadin.flow.internal.hilla.EndpointRequestUtil;
import com.vaadin.flow.server.Constants;
import com.vaadin.flow.server.ExecutionFailedException;
import com.vaadin.flow.server.InitParameters;
@@ -151,10 +152,10 @@ public void should_useHillaEngine_withNodeUpdater()
.when(endpointGeneratorTaskFactory)
.createTaskGenerateEndpoint(Mockito.any());

try (MockedStatic<FrontendUtils> util = Mockito
.mockStatic(FrontendUtils.class, Mockito.CALLS_REAL_METHODS)) {
util.when(() -> FrontendUtils.isHillaUsed(Mockito.any(),
Mockito.any())).thenReturn(true);
try (MockedStatic<EndpointRequestUtil> util = Mockito.mockStatic(
EndpointRequestUtil.class, Mockito.CALLS_REAL_METHODS)) {
util.when(() -> EndpointRequestUtil.isHillaAvailable(Mockito.any()))
.thenReturn(true);
BuildFrontendUtil.runNodeUpdater(adapter);
}

Original file line number Diff line number Diff line change
@@ -22,6 +22,7 @@
import com.vaadin.base.devserver.startup.DevModeStartupListener;
import com.vaadin.flow.di.ResourceProvider;
import com.vaadin.flow.internal.DevModeHandlerManager;
import com.vaadin.flow.internal.hilla.EndpointRequestUtil;
import com.vaadin.flow.server.VaadinServlet;
import com.vaadin.flow.server.VaadinServletContext;
import com.vaadin.flow.server.frontend.EndpointGeneratorTaskFactory;
@@ -107,10 +108,10 @@ public void should_generateOpenApi() throws Exception {
.toFile();

Assert.assertFalse(generatedOpenApiJson.exists());
try (MockedStatic<FrontendUtils> util = Mockito
.mockStatic(FrontendUtils.class, Mockito.CALLS_REAL_METHODS)) {
util.when(() -> FrontendUtils.isHillaUsed(Mockito.any(),
Mockito.any())).thenReturn(true);
try (MockedStatic<EndpointRequestUtil> util = Mockito.mockStatic(
EndpointRequestUtil.class, Mockito.CALLS_REAL_METHODS)) {
util.when(() -> EndpointRequestUtil.isHillaAvailable(Mockito.any()))
.thenReturn(true);
devModeStartupListener.onStartup(classes, servletContext);
handler = getDevModeHandler();
waitForDevServer();
@@ -139,10 +140,10 @@ public void should_generateTs_files() throws Exception {

assertFalse(ts1.exists());
assertFalse(ts2.exists());
try (MockedStatic<FrontendUtils> util = Mockito
.mockStatic(FrontendUtils.class, Mockito.CALLS_REAL_METHODS)) {
util.when(() -> FrontendUtils.isHillaUsed(Mockito.any(),
Mockito.any())).thenReturn(true);
try (MockedStatic<EndpointRequestUtil> util = Mockito.mockStatic(
EndpointRequestUtil.class, Mockito.CALLS_REAL_METHODS)) {
util.when(() -> EndpointRequestUtil.isHillaAvailable(Mockito.any()))
.thenReturn(true);
devModeStartupListener.onStartup(classes, servletContext);
handler = getDevModeHandler();
waitForDevServer();
Original file line number Diff line number Diff line change
@@ -36,6 +36,7 @@
import com.vaadin.flow.component.dependency.JsModule;
import com.vaadin.flow.component.page.AppShellConfigurator;
import com.vaadin.flow.di.Lookup;
import com.vaadin.flow.internal.hilla.EndpointRequestUtil;
import com.vaadin.flow.router.Route;
import com.vaadin.flow.server.InitParameters;
import com.vaadin.flow.server.LoadDependenciesOnStartup;
@@ -352,10 +353,10 @@ public void should_generateOpenApi_when_EndpointPresents()
javaSourceFolder.getRoot().getAbsolutePath());

Assert.assertFalse(generatedOpenApiJson.exists());
try (MockedStatic<FrontendUtils> util = Mockito.mockStatic(
FrontendUtils.class, Mockito.CALLS_REAL_METHODS)) {
util.when(() -> FrontendUtils.isHillaUsed(Mockito.any(),
Mockito.any())).thenReturn(true);
try (MockedStatic<EndpointRequestUtil> util = Mockito.mockStatic(
EndpointRequestUtil.class, Mockito.CALLS_REAL_METHODS)) {
util.when(() -> EndpointRequestUtil
.isHillaAvailable(Mockito.any())).thenReturn(true);
devModeStartupListener.onStartup(classes, servletContext);
handler = getDevModeHandler();
waitForDevServer();
@@ -420,10 +421,10 @@ public void should_generateTs_files() throws Exception {
System.setProperty("vaadin." + CONNECT_JAVA_SOURCE_FOLDER_TOKEN,
javaSourceFolder.getRoot().getAbsolutePath());

try (MockedStatic<FrontendUtils> util = Mockito.mockStatic(
FrontendUtils.class, Mockito.CALLS_REAL_METHODS)) {
util.when(() -> FrontendUtils.isHillaUsed(Mockito.any(),
Mockito.any())).thenReturn(true);
try (MockedStatic<EndpointRequestUtil> util = Mockito.mockStatic(
EndpointRequestUtil.class, Mockito.CALLS_REAL_METHODS)) {
util.when(() -> EndpointRequestUtil
.isHillaAvailable(Mockito.any())).thenReturn(true);
devModeStartupListener.onStartup(classes, servletContext);
handler = getDevModeHandler();
waitForDevServer();

0 comments on commit ce90444

Please sign in to comment.