mirror of
https://github.com/torproject/collector.git
synced 2024-11-27 03:10:28 +00:00
Add a failing test.
Making a static method easier accessible for tests.
This commit is contained in:
parent
727d4e54ef
commit
2e6fa506b3
@ -187,7 +187,7 @@ public class SanitizeWeblogs extends CollecTorMain {
|
||||
}
|
||||
}
|
||||
|
||||
private static byte[] bytesFor(String line, long times) {
|
||||
public static byte[] bytesFor(String line, long times) {
|
||||
return Stream.of(line).limit(times)
|
||||
.collect(Collectors.joining("\n", "", "\n")).getBytes();
|
||||
}
|
||||
|
@ -0,0 +1,20 @@
|
||||
/* Copyright 2017--2018 The Tor Project
|
||||
* See LICENSE for licensing information */
|
||||
|
||||
package org.torproject.collector.webstats;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
public class SanitizeWeblogsTest {
|
||||
|
||||
@Test
|
||||
public void bytesForTest() {
|
||||
String lines = "line\nline\nline\nline\nline\n"
|
||||
+ "line\nline\nline\nline\nline\n";
|
||||
assertEquals(lines, new String(SanitizeWeblogs.bytesFor("line", 10)));
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user