Added more constructors tests.

This commit is contained in:
Erik C. Thauvin 2019-04-04 10:36:17 -07:00
parent b9e4ab4cd1
commit 3dc0f2902e

View file

@ -33,7 +33,9 @@ package net.thauvin.erik.pinboard
import org.testng.Assert import org.testng.Assert
import org.testng.annotations.Test import org.testng.annotations.Test
import java.nio.file.Files
import java.nio.file.Paths import java.nio.file.Paths
import java.util.Properties
class PinboardPosterTest { class PinboardPosterTest {
private val url = "http://www.foo.com/" private val url = "http://www.foo.com/"
@ -58,11 +60,18 @@ class PinboardPosterTest {
@Test @Test
fun testDeletePin() { fun testDeletePin() {
val poster = PinboardPoster(localProps) val props = Properties().apply {
Files.newInputStream(localProps).use { nis ->
load(nis)
}
}
var poster = PinboardPoster(props)
poster.apiEndPoint = "" poster.apiEndPoint = ""
Assert.assertFalse(poster.deletePin(url), "apiEndPoint: <blank>") Assert.assertFalse(poster.deletePin(url), "apiEndPoint: <blank>")
poster = PinboardPoster(localProps, Constants.ENV_API_TOKEN)
poster.apiEndPoint = Constants.API_ENDPOINT poster.apiEndPoint = Constants.API_ENDPOINT
Assert.assertTrue(poster.deletePin(url), "apiEndPoint: ${Constants.API_ENDPOINT}") Assert.assertTrue(poster.deletePin(url), "apiEndPoint: ${Constants.API_ENDPOINT}")