Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
495 changes: 275 additions & 220 deletions pom.xml

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
/*
* Copyright 2012-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// ********RoostGPT********
/*
Test generated by RoostGPT for test java-spring-movie using AI Type Azure Open AI and AI Model roostgpt-4-32k

ROOST_METHOD_HASH=projectGenerationController_10228b07f0
ROOST_METHOD_SIG_HASH=projectGenerationController_88d0687915

Scenario 1: Valid Inputs Produce CustomProjectGenerationController Instance

Details:
TestName: validInputsProduceControllerInstance
Description: Verify that the `projectGenerationController` method correctly returns a `CustomProjectGenerationController` instance when provided valid `InitializrMetadataProvider` and `ApplicationContext` inputs.
Execution:
Arrange: Create mock instances for `InitializrMetadataProvider` and `ApplicationContext`. Ensure that these mock objects are initialized and ready for use.
Act: Call the method `projectGenerationController` with the mock objects as inputs.
Assert: Check if the returned instance is of type `CustomProjectGenerationController`.
Validation:
The assertion ensures that the method processes valid inputs correctly and returns the expected controller type. This is critical for ensuring the core functionality of the application's project generation configuration remains intact.

*/

// ********RoostGPT********

package io.spring.initializr.doc.generator.project;

import io.spring.initializr.metadata.InitializrMetadataProvider;
import org.springframework.context.ApplicationContext;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;
import io.spring.initializr.generator.project.MutableProjectDescription;
import io.spring.initializr.generator.project.ProjectDescription;
import io.spring.initializr.metadata.InitializrMetadata;
import io.spring.initializr.web.controller.ProjectGenerationController;
import io.spring.initializr.web.project.ProjectGenerationInvoker;
import io.spring.initializr.web.project.ProjectRequestToDescriptionConverter;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

class CustomProjectGenerationConfigurationExampleProjectGenerationControllerTest {

@Test
@Tag("valid")
void validInputsProduceControllerInstance() {
// Arrange
InitializrMetadataProvider mockMetadataProvider = mock(InitializrMetadataProvider.class);
ApplicationContext mockApplicationContext = mock(ApplicationContext.class);
CustomProjectGenerationConfigurationExample example = new CustomProjectGenerationConfigurationExample();
// Act
CustomProjectGenerationController controller = example.projectGenerationController(mockMetadataProvider,
mockApplicationContext);
// Assert
assertThat(controller).isNotNull().isInstanceOf(CustomProjectGenerationController.class);
}

@Test
@Tag("invalid")
void nullInputsShouldThrowException() {
// Arrange
InitializrMetadataProvider mockMetadataProvider = mock(InitializrMetadataProvider.class);
ApplicationContext mockApplicationContext = null; // Simulating null input for
// applicationContext
CustomProjectGenerationConfigurationExample example = new CustomProjectGenerationConfigurationExample();
// Act & Assert
assertThatThrownBy(() -> example.projectGenerationController(mockMetadataProvider, mockApplicationContext))
.isInstanceOf(IllegalArgumentException.class)
.hasMessageContaining("ApplicationContext must not be null");
}

}
Loading