mirror of
https://gitee.com/dcren/initializr.git
synced 2025-07-16 16:50:42 +08:00
Fix tests for default dependency
This commit is contained in:
parent
d715066a5e
commit
791fb262ba
@ -16,26 +16,25 @@
|
|||||||
|
|
||||||
package io.spring.initializr.generator
|
package io.spring.initializr.generator
|
||||||
|
|
||||||
|
import static org.mockito.Mockito.mock
|
||||||
|
import static org.mockito.Mockito.times
|
||||||
|
import static org.mockito.Mockito.verify
|
||||||
import io.spring.initializr.metadata.BillOfMaterials
|
import io.spring.initializr.metadata.BillOfMaterials
|
||||||
import io.spring.initializr.metadata.Dependency
|
import io.spring.initializr.metadata.Dependency
|
||||||
import io.spring.initializr.test.GradleBuildAssert
|
import io.spring.initializr.test.GradleBuildAssert
|
||||||
import io.spring.initializr.test.InitializrMetadataTestBuilder
|
import io.spring.initializr.test.InitializrMetadataTestBuilder
|
||||||
import io.spring.initializr.test.PomAssert
|
import io.spring.initializr.test.PomAssert
|
||||||
import io.spring.initializr.test.ProjectAssert
|
import io.spring.initializr.test.ProjectAssert
|
||||||
|
|
||||||
import org.junit.Before
|
import org.junit.Before
|
||||||
import org.junit.Rule
|
import org.junit.Rule
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import org.junit.rules.TemporaryFolder
|
import org.junit.rules.TemporaryFolder
|
||||||
|
|
||||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration
|
import org.springframework.boot.autoconfigure.EnableAutoConfiguration
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication
|
import org.springframework.boot.autoconfigure.SpringBootApplication
|
||||||
import org.springframework.context.annotation.ComponentScan
|
import org.springframework.context.annotation.ComponentScan
|
||||||
import org.springframework.context.annotation.Configuration
|
import org.springframework.context.annotation.Configuration
|
||||||
|
|
||||||
import static org.mockito.Mockito.mock
|
|
||||||
import static org.mockito.Mockito.times
|
|
||||||
import static org.mockito.Mockito.verify
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Stephane Nicoll
|
* @author Stephane Nicoll
|
||||||
*/
|
*/
|
||||||
@ -113,7 +112,7 @@ class ProjectGeneratorTests {
|
|||||||
def request = createProjectRequest('thymeleaf')
|
def request = createProjectRequest('thymeleaf')
|
||||||
generateMavenPom(request)
|
generateMavenPom(request)
|
||||||
.hasDependency('org.foo', 'thymeleaf')
|
.hasDependency('org.foo', 'thymeleaf')
|
||||||
.hasDependenciesCount(2)
|
.hasDependenciesCount(3)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -132,7 +131,7 @@ class ProjectGeneratorTests {
|
|||||||
.hasSpringBootStarterTomcat()
|
.hasSpringBootStarterTomcat()
|
||||||
.hasDependency('org.foo', 'thymeleaf') // This is tagged as web facet so it brings the web one
|
.hasDependency('org.foo', 'thymeleaf') // This is tagged as web facet so it brings the web one
|
||||||
.hasSpringBootStarterTest()
|
.hasSpringBootStarterTest()
|
||||||
.hasDependenciesCount(3)
|
.hasDependenciesCount(4)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -273,9 +272,9 @@ class ProjectGeneratorTests {
|
|||||||
void mavenPomWithCustomScope() {
|
void mavenPomWithCustomScope() {
|
||||||
def h2 = new Dependency(id: 'h2', groupId: 'org.h2', artifactId: 'h2', scope: 'runtime')
|
def h2 = new Dependency(id: 'h2', groupId: 'org.h2', artifactId: 'h2', scope: 'runtime')
|
||||||
def hamcrest = new Dependency(id: 'hamcrest', groupId: 'org.hamcrest',
|
def hamcrest = new Dependency(id: 'hamcrest', groupId: 'org.hamcrest',
|
||||||
artifactId: 'hamcrest', scope: 'test')
|
artifactId: 'hamcrest', scope: 'test')
|
||||||
def servlet = new Dependency(id: 'servlet-api', groupId: 'javax.servlet',
|
def servlet = new Dependency(id: 'servlet-api', groupId: 'javax.servlet',
|
||||||
artifactId: 'servlet-api', scope: 'provided')
|
artifactId: 'servlet-api', scope: 'provided')
|
||||||
def metadata = InitializrMetadataTestBuilder.withDefaults()
|
def metadata = InitializrMetadataTestBuilder.withDefaults()
|
||||||
.addDependencyGroup('core', 'web', 'security', 'data-jpa')
|
.addDependencyGroup('core', 'web', 'security', 'data-jpa')
|
||||||
.addDependencyGroup('database', h2)
|
.addDependencyGroup('database', h2)
|
||||||
@ -292,9 +291,9 @@ class ProjectGeneratorTests {
|
|||||||
void gradleBuildWithCustomScope() {
|
void gradleBuildWithCustomScope() {
|
||||||
def h2 = new Dependency(id: 'h2', groupId: 'org.h2', artifactId: 'h2', scope: 'runtime')
|
def h2 = new Dependency(id: 'h2', groupId: 'org.h2', artifactId: 'h2', scope: 'runtime')
|
||||||
def hamcrest = new Dependency(id: 'hamcrest', groupId: 'org.hamcrest',
|
def hamcrest = new Dependency(id: 'hamcrest', groupId: 'org.hamcrest',
|
||||||
artifactId: 'hamcrest', scope: 'test')
|
artifactId: 'hamcrest', scope: 'test')
|
||||||
def servlet = new Dependency(id: 'servlet-api', groupId: 'javax.servlet',
|
def servlet = new Dependency(id: 'servlet-api', groupId: 'javax.servlet',
|
||||||
artifactId: 'servlet-api', scope: 'provided')
|
artifactId: 'servlet-api', scope: 'provided')
|
||||||
def metadata = InitializrMetadataTestBuilder.withDefaults()
|
def metadata = InitializrMetadataTestBuilder.withDefaults()
|
||||||
.addDependencyGroup('core', 'web', 'security', 'data-jpa')
|
.addDependencyGroup('core', 'web', 'security', 'data-jpa')
|
||||||
.addDependencyGroup('database', h2)
|
.addDependencyGroup('database', h2)
|
||||||
@ -478,5 +477,4 @@ class ProjectGeneratorTests {
|
|||||||
request.style.addAll Arrays.asList(styles)
|
request.style.addAll Arrays.asList(styles)
|
||||||
request
|
request
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -62,7 +62,7 @@ class MainControllerIntegrationTests extends AbstractInitializrControllerIntegra
|
|||||||
void simpleTgzProject() {
|
void simpleTgzProject() {
|
||||||
downloadTgz('/starter.tgz?style=org.acme:foo').isJavaProject().isMavenProject()
|
downloadTgz('/starter.tgz?style=org.acme:foo').isJavaProject().isMavenProject()
|
||||||
.hasStaticAndTemplatesResources(false).pomAssert()
|
.hasStaticAndTemplatesResources(false).pomAssert()
|
||||||
.hasDependenciesCount(2)
|
.hasDependenciesCount(3)
|
||||||
.hasDependency('org.acme', 'foo', '1.3.5')
|
.hasDependency('org.acme', 'foo', '1.3.5')
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -72,7 +72,7 @@ class MainControllerIntegrationTests extends AbstractInitializrControllerIntegra
|
|||||||
artifactId: 'biz', version: '1.3.5', scope: 'runtime')
|
artifactId: 'biz', version: '1.3.5', scope: 'runtime')
|
||||||
downloadTgz('/starter.tgz?style=org.acme:biz&bootVersion=1.2.1.RELEASE').isJavaProject().isMavenProject()
|
downloadTgz('/starter.tgz?style=org.acme:biz&bootVersion=1.2.1.RELEASE').isJavaProject().isMavenProject()
|
||||||
.hasStaticAndTemplatesResources(false).pomAssert()
|
.hasStaticAndTemplatesResources(false).pomAssert()
|
||||||
.hasDependenciesCount(2)
|
.hasDependenciesCount(3)
|
||||||
.hasDependency(biz)
|
.hasDependency(biz)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user