diff --git a/library/SjpApi.jar b/library/SjpApi.jar index b373da1..ef8a266 100644 Binary files a/library/SjpApi.jar and b/library/SjpApi.jar differ diff --git a/src/CurlHelper.java b/src/CurlHelper.java index 36d46ce..9fd86cb 100644 --- a/src/CurlHelper.java +++ b/src/CurlHelper.java @@ -1,10 +1,6 @@ package com.sjp.sjpapi; -import java.io.BufferedReader; import java.io.IOException; -import java.io.InputStreamReader; -import java.net.MalformedURLException; -import java.net.URL; public class CurlHelper { @@ -20,7 +16,7 @@ public static String getOutputFromCurl(String word) throws IOException { String outputFromCurl = readCurlFromSJP(word); if (validator.isCurlValidate(outputFromCurl) == true) { - return wrapper.deleteHeadFromOutput(outputFromCurl); + return wrapper.getBettwenH1AndCommentSection(outputFromCurl); } return ""; } diff --git a/src/CurlWrapper.java b/src/CurlWrapper.java index fc9f27f..bfb3fe6 100644 --- a/src/CurlWrapper.java +++ b/src/CurlWrapper.java @@ -3,18 +3,18 @@ public class CurlWrapper { public String wrappCurl(String curlOutput) { - return deleteHeadFromOutput(curlOutput); + return getBettwenH1AndCommentSection(curlOutput); } - public String deleteHeadFromOutput(String curlOutput) { + public String getBettwenH1AndCommentSection(String curlOutput) { - String outputWithoutHeadSection = curlOutput; + String outputBettwenH1AndComment = curlOutput; - String bodySectionStart = ""; - String bodySectionFinis = ""; - outputWithoutHeadSection = StringUtils.substringBettwen(outputWithoutHeadSection,bodySectionStart,bodySectionFinis); + String h1SectionStart = ""); + //int startSection = substringString.indexOf(openingSequence) + openingSequence.length(); + int startSection = substringString.indexOf(openingSequence); + int finisSection = substringString.indexOf(closingSequence); substringString = substringString.substring(startSection, finisSection); return substringString; diff --git a/test/CurlWrapperTest.java b/test/CurlWrapperTest.java index e2f792d..8bf4927 100644 --- a/test/CurlWrapperTest.java +++ b/test/CurlWrapperTest.java @@ -1,17 +1,15 @@ -package sjpAPI; +package com.sjp; import junit.framework.TestCase; -import org.junit.Assert; - public class CurlWrapperTest extends TestCase { private CurlWrapper wrapper = new CurlWrapper(); - public void testIsNOTHeadInOutput() { - String mockCurl = "asdasdsadasd fgdfggfhtyjfhghfgd asfdfhtyhhjdffsdc"; + public void testIsBettwenH1AndCommentSection() { + String mockCurl = "asdasdsadasd

fgdfggfhtyjfhghfgd

KOMENTARZE: asfdfhtyhhjdffsdc"; mockCurl = wrapper.wrappCurl(mockCurl); - assertEquals(mockCurl,"fgdfggfhtyjfhghfgd"); + assertEquals(mockCurl,"

fgdfggfhtyjfhghfgd

"); } } \ No newline at end of file