BAEL-4516: Cleanup sources

This commit is contained in:
Sorin Zamfir 2020-08-18 21:52:30 +03:00
parent 0df340f847
commit 92d27d3876
5 changed files with 36 additions and 35 deletions

View File

@ -5,11 +5,11 @@ plugins{
description = "Gradle 5 root project" description = "Gradle 5 root project"
allprojects { allprojects {
apply plugin :"java" apply plugin :"java"
apply plugin :"nebula.lint" // apply plugin :"nebula.lint"
gradleLint { // gradleLint {
rules=['unused-dependency'] // rules=['unused-dependency']
reportFormat = 'text' // reportFormat = 'text'
} // }
group = "com.baeldung" group = "com.baeldung"
version = "0.0.1" version = "0.0.1"
sourceCompatibility = "1.8" sourceCompatibility = "1.8"

View File

@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-bin.zip

View File

@ -1,10 +1,12 @@
apply plugin: "eclipse" // apply plugin: "eclipse"
apply plugin: "java" apply plugin: "java"
description = "Source Sets example" description = "Source Sets example"
task printSourceSetInformation(){ task printSourceSetInformation(){
description = "Print source set information"
doLast{ doLast{
sourceSets.each { srcSet -> sourceSets.each { srcSet ->
println "["+srcSet.name+"]" println "["+srcSet.name+"]"
@ -19,14 +21,6 @@ task printSourceSetInformation(){
} }
} }
task printConfigurationInformation(){
doLast{
configurations.each { config ->
println "["+config.name+"]"
}
}
}
sourceSets{ sourceSets{
itest { itest {
compileClasspath += sourceSets.main.output compileClasspath += sourceSets.main.output
@ -42,26 +36,31 @@ test {
} }
} }
// main {
// java {
// srcDir('src/random')
// }
// }
dependencies { dependencies {
implementation('org.apache.httpcomponents:httpclient:4.5.12') implementation('org.apache.httpcomponents:httpclient:4.5.12')
testImplementation('junit:junit:4.12') testImplementation('junit:junit:4.12')
itestImplementation('com.google.guava:guava:29.0-jre') itestImplementation('com.google.guava:guava:29.0-jre')
} }
configurations { task itest(type: Test) {
itestImplementation.extendsFrom(testImplementation) description = "Run integration tests"
itestRuntimeOnly.extendsFrom(t) group = "verification"
testClassesDirs = sourceSets.itest.output.classesDirs
classpath = sourceSets.itest.runtimeClasspath
} }
task itest(Type: test) { itest {
testLogging {
events "passed","skipped", "failed"
}
} }
configurations {
itestImplementation.extendsFrom(testImplementation)
itestRuntimeOnly.extendsFrom(testRuntimeOnly)
}
// eclipse { // eclipse {
// classpath { // classpath {
// plusConfigurations+=[configurations.itestCompileClasspath] // plusConfigurations+=[configurations.itestCompileClasspath]

View File

@ -3,27 +3,29 @@ package com.baeldung.itest;
import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat; import static org.junit.Assert.assertThat;
//import java.util.List; import java.util.List;
import org.junit.Test; import org.junit.Test;
import com.baeldung.main.SourceSetsObject; import com.baeldung.main.SourceSetsObject;
//import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
public class SourceSetsItest { public class SourceSetsItest {
@Test @Test
public void whenRunThenSuccess() { public void whenRunThenSuccess() {
SourceSetsObject underTest = new SourceSetsObject("lorem","ipsum"); SourceSetsObject underTest = new SourceSetsObject("lorem", "ipsum");
assertThat(underTest.getUser(), is("lorem")); assertThat(underTest.getUser(), is("lorem"));
assertThat(underTest.getPassword(), is("ipsum")); assertThat(underTest.getPassword(), is("ipsum"));
} }
// @Test @Test
// public void whenRunThenFail() { public void givenImmutableListwhenRunThenSuccess() {
// List<String> someStrings = ImmutableList.of("Baeldung", "is", "cool");
// assertThat(false, is(true)); List<String> someStrings = ImmutableList.of("Baeldung", "is", "cool");
// }
assertThat(someStrings.size(), is(3));
}
} }