mirror of
https://github.com/ysoftdevs/gradle-training.git
synced 2026-03-20 08:14:54 +01:00
initial import of project
This commit is contained in:
28
06-maven-deployer/build.gradle
Normal file
28
06-maven-deployer/build.gradle
Normal file
@@ -0,0 +1,28 @@
|
||||
apply plugin: 'java'
|
||||
apply plugin: 'maven'
|
||||
|
||||
version = '0.1-SNAPSHOT'
|
||||
group = 'com.sinusgear.training'
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
testCompile group: 'org.testng', name: 'testng', version: '6.+'
|
||||
}
|
||||
|
||||
test {
|
||||
useTestNG()
|
||||
}
|
||||
|
||||
uploadArchives {
|
||||
repositories {
|
||||
mavenDeployer {
|
||||
repository(url: "file:///idea/training/repo")
|
||||
// use timestamp, e.g.: 06-maven-deployer-0.1-20140408.195954-2
|
||||
uniqueVersion = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.ysoft.training;
|
||||
|
||||
// Generate Checkstyle warning - unused import
|
||||
import java.util.Date;
|
||||
|
||||
public class Calculator {
|
||||
|
||||
/** Internal counter */
|
||||
private int counter;
|
||||
|
||||
Calculator() {
|
||||
counter = 0;
|
||||
}
|
||||
|
||||
|
||||
public int getCounter() {
|
||||
return counter;
|
||||
}
|
||||
|
||||
void add(int i) {
|
||||
|
||||
// Generate PMD warning
|
||||
if (i==1) {
|
||||
}
|
||||
|
||||
counter += i;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.ysoft.training;
|
||||
|
||||
import com.ysoft.training.Calculator;
|
||||
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
public class TestCalculator {
|
||||
|
||||
@Test
|
||||
public void testAdd() {
|
||||
Calculator calc = new Calculator();
|
||||
calc.add(1);
|
||||
Assert.assertEquals(calc.getCounter(), 1);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user