Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file added dd
Empty file.
9 changes: 9 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,15 @@
<version>3.5.2</version>
</dependency>

<!-- https://mvnrepository.com/artifact/org.jsoup/jsoup -->
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.8.3</version>
</dependency>




</dependencies>

Expand Down
1 change: 1 addition & 0 deletions src/main/java/arytmetyka/Kalkulator.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public int div(int x, int y) {
public void petla(int x){
for (int i = 0; i <x ; i++) {
System.out.println("to wyswietla sie "+ i+ "raz w petli");
System.out.println("test");
}

}
Expand Down
12 changes: 12 additions & 0 deletions src/main/java/htmlutils/RemoveHtmlTags.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package htmlutils;

import org.jsoup.Jsoup;

/**
* Created on 10.09.16, at 08:59
*/
public class RemoveHtmlTags {
public String removeTags(String source) {
return Jsoup.parse(source).text();
}
}
30 changes: 30 additions & 0 deletions src/test/java/htmlutils/RemoveHtmlTagsTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package htmlutils;

import org.junit.Before;
import org.junit.Test;

import static org.junit.Assert.*;
import static org.assertj.core.api.Assertions.*;


public class RemoveHtmlTagsTest {
RemoveHtmlTags testee;

@Before
public void setUp() throws Exception {
testee = new RemoveHtmlTags();

}

@Test
public void simpleremoveTest() {
String src = "<b>";
assertThat(testee.removeTags(src)).isEqualTo("");
}

@Test
public void moreComplicatedTest() {
String src = "<p> <span> foo </span> <em> bar <a> foobar </a> baz </em> </p>";
assertThat(testee.removeTags(src)).isEqualTo("foo bar foobar baz");
}
}