Skip to content

Commit

Permalink
#876 corrected test for PsFacebook
Browse files Browse the repository at this point in the history
  • Loading branch information
krzyk committed Dec 7, 2018
1 parent 1a11256 commit 44ac957
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
12 changes: 6 additions & 6 deletions pom.xml
Expand Up @@ -244,7 +244,13 @@ SOFTWARE.
<version>2.6</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-text</artifactId>
<version>1.4</version>
</dependency>
</dependencies>

<build>
<testResources>
<testResource>
Expand Down Expand Up @@ -375,12 +381,6 @@ SOFTWARE.
to pass. In 0.17.6, some changes impact a lot of file, while in
0.18 there should be less new issues. Don't forget about the IT
test ran by maven-invoker-plugin.
@todo #837:30min Finish the upgrade to qulice 0.17.5 by reviewing
all diamond usage: it was required until now to explicit the
type in generics but it is not needed anymore. For example in
BkTimetable line 65, new ConcurrentHashMap<Thread, Long>(1)
should be new ConcurrentHashMap<>(1). There are around 70
cases like that.
-->
<version>${qulice.version}</version>
<configuration>
Expand Down
18 changes: 12 additions & 6 deletions src/test/java/org/takes/facets/auth/social/PsFacebookTest.java
Expand Up @@ -26,9 +26,10 @@
import com.jcabi.http.request.FakeRequest;
import com.restfb.DefaultWebRequestor;
import java.net.HttpURLConnection;
import java.nio.charset.StandardCharsets;
import java.util.Collections;
import java.util.Map;
import org.apache.commons.lang.RandomStringUtils;
import org.apache.commons.text.RandomStringGenerator;
import org.hamcrest.CoreMatchers;
import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
Expand All @@ -52,15 +53,20 @@ public class PsFacebookTest {
@Test
public final void canLogin() throws Exception {
final String identifier = RandomStringUtils.randomAlphanumeric(10);
final RandomStringGenerator generator =
new RandomStringGenerator.Builder()
.filteredBy(
Character::isLetterOrDigit, Character::isIdeographic
).build();
final Pass pass = new PsFacebook(
new FakeRequest(
200,
"HTTP OK",
Collections.<Map.Entry<String, String>>emptyList(),
Collections.emptyList(),
String.format(
"access_token=%s",
RandomStringUtils.randomAlphanumeric(10)
).getBytes("utf-8")
).getBytes(StandardCharsets.UTF_8)
),
new DefaultWebRequestor() {
@Override
Expand All @@ -70,13 +76,13 @@ public Response executeGet(final String url) {
String.format(
"{\"id\":\"%s\",\"name\":\"%s\"}",
identifier,
RandomStringUtils.random(10)
generator.generate(10)
)
);
}
},
RandomStringUtils.random(10),
RandomStringUtils.random(10)
generator.generate(10),
generator.generate(10)
);
final Opt<Identity> identity = pass.enter(
new RqFake(
Expand Down

0 comments on commit 44ac957

Please sign in to comment.