Added tests.
This commit is contained in:
parent
423d8494c2
commit
b9714a067d
6 changed files with 176 additions and 24 deletions
2
.idea/kobalt.xml
generated
2
.idea/kobalt.xml
generated
|
@ -6,7 +6,7 @@
|
|||
<option name="autoDownloadKobalt" value="true" />
|
||||
<option name="downloadSources" value="false" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
<option name="kobaltHome" value="$USER_HOME$/.kobalt/wrapper/dist/kobalt-1.0.87" />
|
||||
<option name="kobaltHome" value="$USER_HOME$/.kobalt/wrapper/dist/kobalt-1.0.90" />
|
||||
<option name="modules">
|
||||
<set>
|
||||
<option value="$PROJECT_DIR$" />
|
||||
|
|
2
.idea/scopes/Source.xml
generated
2
.idea/scopes/Source.xml
generated
|
@ -1,3 +1,3 @@
|
|||
<component name="DependencyValidationManager">
|
||||
<scope name="Source" pattern="file[pinboard-poster]:src/main/java//*.java||file[pinboard-poster]:src/main/kotlin//*.kt" />
|
||||
<scope name="Source" pattern="file[pinboard-poster]:src/main/java//*.java||file[pinboard-poster]:src/main/kotlin//*.kt||file[pinboard-poster]:src/test/kotlin//*.kt" />
|
||||
</component>
|
|
@ -10,13 +10,22 @@
|
|||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="module-library">
|
||||
<library name="Kobalt: com.beust.kobalt:kobalt:jar:1.0.86">
|
||||
<library name="Kobalt: kobalt-versioneye-0.4.5.jar">
|
||||
<CLASSES>
|
||||
<root url="jar://$USER_HOME$/.kobalt/wrapper/dist/kobalt-1.0.86/kobalt/wrapper/kobalt-1.0.86.jar!/" />
|
||||
<root url="jar://$USER_HOME$/.kobalt/cache/net/thauvin/erik/kobalt-versioneye/0.4.5/kobalt-versioneye-0.4.5.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library">
|
||||
<library name="Kobalt: com.beust.kobalt:kobalt:jar:1.0.90">
|
||||
<CLASSES>
|
||||
<root url="jar://$USER_HOME$/.kobalt/wrapper/dist/kobalt-1.0.90/kobalt/wrapper/kobalt-1.0.90.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES>
|
||||
<root url="jar://$USER_HOME$/.kobalt/wrapper/dist/kobalt-1.0.86/kobalt/wrapper/kobalt-1.0.86-sources.jar!/" />
|
||||
<root url="jar://$USER_HOME$/.kobalt/wrapper/dist/kobalt-1.0.90/kobalt/wrapper/kobalt-1.0.90-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</orderEntry>
|
||||
|
@ -29,14 +38,5 @@
|
|||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library">
|
||||
<library name="Kobalt: kobalt-versioneye-0.4.5.jar">
|
||||
<CLASSES>
|
||||
<root url="jar://$USER_HOME$/.kobalt/cache/net/thauvin/erik/kobalt-versioneye/0.4.5/kobalt-versioneye-0.4.5.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
</component>
|
||||
</module>
|
|
@ -57,8 +57,7 @@ val p = project {
|
|||
}
|
||||
|
||||
dependenciesTest {
|
||||
//compile("org.testng:testng:6.11")
|
||||
//compile("org.jetbrains.kotlin:kotlin-test:1.1.2-3")
|
||||
compile("org.testng:testng:6.12")
|
||||
}
|
||||
|
||||
assemble {
|
||||
|
|
|
@ -13,27 +13,81 @@
|
|||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="module-library">
|
||||
<library name="Kobalt: org.jetbrains.kotlin:kotlin-stdlib:jar:1.1.2-3">
|
||||
<library name="Kobalt: org.jetbrains.kotlin:kotlin-stdlib:jar:1.1.51">
|
||||
<CLASSES>
|
||||
<root url="jar://$USER_HOME$/.kobalt/cache/org/jetbrains/kotlin/kotlin-stdlib/1.1.2-3/kotlin-stdlib-1.1.2-3.jar!/" />
|
||||
<root url="jar://$USER_HOME$/.kobalt/cache/org/jetbrains/kotlin/kotlin-stdlib/1.1.51/kotlin-stdlib-1.1.51.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library">
|
||||
<library name="Kobalt: com.squareup.okhttp3:okhttp:jar:3.8.0">
|
||||
<orderEntry type="module-library" scope="TEST">
|
||||
<library name="Kobalt: org.apache.ant:ant-launcher:jar:1.9.7">
|
||||
<CLASSES>
|
||||
<root url="jar://$USER_HOME$/.kobalt/cache/com/squareup/okhttp3/okhttp/3.8.0/okhttp-3.8.0.jar!/" />
|
||||
<root url="jar://$USER_HOME$/.kobalt/cache/org/apache/ant/ant-launcher/1.9.7/ant-launcher-1.9.7.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library">
|
||||
<library name="Kobalt: org.jetbrains:annotations:jar:13.0">
|
||||
<orderEntry type="module-library" scope="TEST">
|
||||
<library name="Kobalt: org.hamcrest:hamcrest-core:jar:1.3">
|
||||
<CLASSES>
|
||||
<root url="jar://$USER_HOME$/.kobalt/cache/org/jetbrains/annotations/13.0/annotations-13.0.jar!/" />
|
||||
<root url="jar://$USER_HOME$/.kobalt/cache/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library" scope="TEST">
|
||||
<library name="Kobalt: org.apache-extras.beanshell:bsh:jar:2.0b6">
|
||||
<CLASSES>
|
||||
<root url="jar://$USER_HOME$/.kobalt/cache/org/apache-extras/beanshell/bsh/2.0b6/bsh-2.0b6.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library" scope="TEST">
|
||||
<library name="Kobalt: org.apache.ant:ant:jar:1.9.7">
|
||||
<CLASSES>
|
||||
<root url="jar://$USER_HOME$/.kobalt/cache/org/apache/ant/ant/1.9.7/ant-1.9.7.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library" scope="TEST">
|
||||
<library name="Kobalt: junit:junit:jar:4.12">
|
||||
<CLASSES>
|
||||
<root url="jar://$USER_HOME$/.kobalt/cache/junit/junit/4.12/junit-4.12.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library" scope="TEST">
|
||||
<library name="Kobalt: com.google.code.findbugs:jsr305:jar:3.0.1">
|
||||
<CLASSES>
|
||||
<root url="jar://$USER_HOME$/.kobalt/cache/com/google/code/findbugs/jsr305/3.0.1/jsr305-3.0.1.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library" scope="TEST">
|
||||
<library name="Kobalt: org.yaml:snakeyaml:jar:1.17">
|
||||
<CLASSES>
|
||||
<root url="jar://$USER_HOME$/.kobalt/cache/org/yaml/snakeyaml/1.17/snakeyaml-1.17.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library" scope="TEST">
|
||||
<library name="Kobalt: com.beust:jcommander:jar:1.66">
|
||||
<CLASSES>
|
||||
<root url="jar://$USER_HOME$/.kobalt/cache/com/beust/jcommander/1.66/jcommander-1.66.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
|
@ -48,5 +102,32 @@
|
|||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library">
|
||||
<library name="Kobalt: org.jetbrains:annotations:jar:13.0">
|
||||
<CLASSES>
|
||||
<root url="jar://$USER_HOME$/.kobalt/cache/org/jetbrains/annotations/13.0/annotations-13.0.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library" scope="TEST">
|
||||
<library name="Kobalt: org.testng:testng:jar:6.12">
|
||||
<CLASSES>
|
||||
<root url="jar://$USER_HOME$/.kobalt/cache/org/testng/testng/6.12/testng-6.12.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library">
|
||||
<library name="Kobalt: com.squareup.okhttp3:okhttp:jar:3.9.0">
|
||||
<CLASSES>
|
||||
<root url="jar://$USER_HOME$/.kobalt/cache/com/squareup/okhttp3/okhttp/3.9.0/okhttp-3.9.0.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
</component>
|
||||
</module>
|
|
@ -0,0 +1,72 @@
|
|||
/*
|
||||
* PinboardPosterTest.kt
|
||||
*
|
||||
* Copyright (c) 2017, Erik C. Thauvin (erik@thauvin.net)
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
*
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* Neither the name of this project nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package net.thauvin.erik.pinboard
|
||||
|
||||
import org.testng.Assert
|
||||
import org.testng.annotations.Test
|
||||
import java.io.FileInputStream
|
||||
import java.util.*
|
||||
|
||||
class PinboardPosterTest {
|
||||
private val url = "http://www.foo.com/"
|
||||
private val desc = "This is a test."
|
||||
private val p = Properties().apply { FileInputStream("local.properties").use { fis -> load(fis) } }
|
||||
private val apiToken = p.getProperty("pinboard-api-token")
|
||||
|
||||
@Test
|
||||
fun testAddPin() {
|
||||
val poster = PinboardPoster("")
|
||||
|
||||
Assert.assertFalse(poster.addPin(url, desc), "apiToken: <blank>")
|
||||
|
||||
Assert.assertFalse(poster.addPin(url, desc), "apiToken: <blank>")
|
||||
|
||||
//poster.apiToken = "foo:TESTING"
|
||||
//Assert.assertFalse(poster.addPin(url, desc), "apiToken: ${poster.apiToken}")
|
||||
|
||||
poster.apiToken = apiToken
|
||||
Assert.assertTrue(poster.addPin(url, desc), "apiToken: $apiToken")
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testDeletePin() {
|
||||
val poster = PinboardPoster(apiToken)
|
||||
|
||||
poster.apiEndPoint = ""
|
||||
Assert.assertFalse(poster.deletePin(url), "apiEndPoint: <blank>")
|
||||
|
||||
poster.apiEndPoint = Constants.API_ENDPOINT
|
||||
Assert.assertTrue(poster.deletePin(url), "apiEndPoint: ${Constants.API_ENDPOINT}")
|
||||
|
||||
Assert.assertFalse(poster.deletePin("foo.com"), "url: foo.com")
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue