package org.eclipse.jgit.http.test;
+import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static org.eclipse.jgit.util.FileUtils.delete;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.notNullValue;
+import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import java.io.File;
import org.eclipse.jgit.dircache.DirCache;
import org.eclipse.jgit.dircache.DirCacheEditor;
import org.eclipse.jgit.dircache.DirCacheEditor.PathEdit;
-import org.eclipse.jgit.internal.storage.file.FileRepository;
import org.eclipse.jgit.dircache.DirCacheEntry;
+import org.eclipse.jgit.internal.storage.file.FileRepository;
import org.eclipse.jgit.junit.JGitTestUtil;
import org.eclipse.jgit.junit.RepositoryTestCase;
import org.eclipse.jgit.lib.FileMode;
package org.eclipse.jgit.internal.storage.file;
+import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.lessThanOrEqualTo;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertThat;
import java.io.File;
import java.io.IOException;
import static java.util.Comparator.comparing;
import static java.util.stream.Collectors.toList;
-
import static org.eclipse.jgit.lib.Constants.OBJ_BLOB;
import static org.eclipse.jgit.lib.Constants.OBJ_COMMIT;
+import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.greaterThan;
import static org.hamcrest.Matchers.lessThan;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertThat;
import static org.junit.Assert.fail;
import java.io.ByteArrayInputStream;
import static org.eclipse.jgit.lib.Ref.Storage.NEW;
import static org.eclipse.jgit.lib.Ref.Storage.PACKED;
import static org.hamcrest.CoreMatchers.containsString;
+import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertThrows;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
*/
package org.eclipse.jgit.internal.transport.http;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
import java.io.IOException;
import java.io.InputStream;
import java.io.Writer;
import java.util.regex.Pattern;
import org.eclipse.jgit.internal.storage.file.LockFile;
-import org.eclipse.jgit.internal.transport.http.NetscapeCookieFile;
import org.eclipse.jgit.util.http.HttpCookiesMatcher;
import org.hamcrest.CoreMatchers;
-import org.junit.Assert;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
cookie = new HttpCookie("key3", "valueFromSet2");
cookiesExpectedMergedSet.add(cookie);
- Assert.assertThat(
- NetscapeCookieFile.mergeCookies(cookieSet1, cookieSet2),
+ assertThat(NetscapeCookieFile.mergeCookies(cookieSet1, cookieSet2),
HttpCookiesMatcher.containsInOrder(cookiesExpectedMergedSet));
- Assert.assertThat(NetscapeCookieFile.mergeCookies(cookieSet1, null),
+ assertThat(NetscapeCookieFile.mergeCookies(cookieSet1, null),
HttpCookiesMatcher.containsInOrder(cookieSet1));
}
String expectedExpiration = String
.valueOf(creationDate.getTime() + (cookie.getMaxAge() * 1000));
- Assert.assertThat(
- Files.readAllLines(tmpFile, StandardCharsets.US_ASCII),
+ assertThat(Files.readAllLines(tmpFile, StandardCharsets.US_ASCII),
CoreMatchers
.equalTo(Arrays.asList("mydomain.com\tTRUE\t/\tTRUE\t"
+ expectedExpiration + "\tkey2\tvalue")));
String expectedExpiration = String
.valueOf(creationDate.getTime() + (cookie.getMaxAge() * 1000));
- Assert.assertThat(
- Files.readAllLines(tmpFile, StandardCharsets.US_ASCII),
+ assertThat(Files.readAllLines(tmpFile, StandardCharsets.US_ASCII),
CoreMatchers.equalTo(
Arrays.asList("domain.com\tTRUE\t/my/path\tFALSE\t"
+ expectedExpiration + "\tkey2\tvalue2")));
// now imitate another process/thread holding the lock file
LockFile lockFile = new LockFile(tmpFile.toFile());
try {
- Assert.assertTrue("Could not acquire lock", lockFile.lock());
+ assertTrue("Could not acquire lock", lockFile.lock());
cookieFile.write(baseUrl);
} finally {
lockFile.unlock();
List<String> lines = Files.readAllLines(tmpFile,
StandardCharsets.US_ASCII);
- Assert.assertEquals("Expected 3 lines", 3, lines.size());
+ assertEquals("Expected 3 lines", 3, lines.size());
assertStringMatchesPatternWithInexactNumber(lines.get(0),
"some-domain1\tTRUE\t/some/path1\tFALSE\t(\\d*)\tkey1\tvalueFromSimple2",
JAN_01_2030_NOON, 1000);
long delta) {
java.util.regex.Matcher matcher = Pattern.compile(pattern)
.matcher(string);
- Assert.assertTrue("Given string '" + string + "' does not match '"
- + pattern + "'", matcher.matches());
+ assertTrue("Given string '" + string + "' does not match '" + pattern
+ + "'", matcher.matches());
// extract numeric value
Long actualNumericValue = Long.decode(matcher.group(1));
- Assert.assertTrue(
+ assertTrue(
"Value is supposed to be close to " + expectedNumericValue
+ " but is " + actualNumericValue + ".",
Math.abs(expectedNumericValue - actualNumericValue) <= delta);
}
Set<HttpCookie> actualCookies = new NetscapeCookieFile(tmpFile,
creationDate).getCookies(true);
- Assert.assertThat(actualCookies,
- HttpCookiesMatcher.containsInOrder(cookies));
+ assertThat(actualCookies, HttpCookiesMatcher.containsInOrder(cookies));
}
@Test
NetscapeCookieFile.write(writer, cookies, baseUrl, creationDate);
}
// compare original file with newly written one, they should not differ
- Assert.assertEquals(Files.readAllLines(tmpFile),
- Files.readAllLines(tmpFile2));
+ assertEquals(Files.readAllLines(tmpFile), Files.readAllLines(tmpFile2));
}
@Test
Set<HttpCookie> actualCookies = new NetscapeCookieFile(tmpFile, creationDate)
.getCookies(true);
- Assert.assertThat(actualCookies,
- HttpCookiesMatcher.containsInOrder(cookies));
+ assertThat(actualCookies, HttpCookiesMatcher.containsInOrder(cookies));
}
@Test
package org.eclipse.jgit.lib;
import static org.hamcrest.CoreMatchers.hasItem;
+import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNotSame;
import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
package org.eclipse.jgit.transport;
import static org.eclipse.jgit.transport.ObjectIdMatcher.hasOnlyObjectIds;
+import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import java.io.ByteArrayInputStream;
*/
package org.eclipse.jgit.transport;
+import static org.eclipse.jgit.transport.ObjectIdMatcher.hasOnlyObjectIds;
+import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.hasItems;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
-import static org.eclipse.jgit.transport.ObjectIdMatcher.hasOnlyObjectIds;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
*/
package org.eclipse.jgit.transport;
+import static org.hamcrest.MatcherAssert.assertThat;
+
import java.io.File;
import java.io.IOException;
import java.net.HttpCookie;
cookie.setMaxAge(1234);
expectedCookies.add(cookie);
- Assert.assertThat(
+ assertThat(
new NetscapeCookieFile(cookieFile.toPath())
.getCookies(true),
HttpCookiesMatcher.containsInOrder(expectedCookies, 5));
*/
package org.eclipse.jgit.transport;
+import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.containsString;
import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertThrows;
import static org.junit.Assert.assertTrue;
package org.eclipse.jgit.transport;
+import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
-import static org.junit.Assert.assertThat;
import java.util.List;
import java.util.stream.Collectors;
package org.eclipse.jgit.transport;
+import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.containsInAnyOrder;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.hasItems;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertThrows;
import static org.junit.Assert.assertTrue;
*/
package org.eclipse.jgit.util;
+import static org.hamcrest.MatcherAssert.assertThat;
+
import java.util.LinkedHashMap;
import java.util.Map;
import org.hamcrest.collection.IsIterableContainingInOrder;
-import org.junit.Assert;
import org.junit.Test;
public class LRUMapTest {
expectedMap.put(0, 0);
expectedMap.put(3, 3);
- Assert.assertThat(map.entrySet(),
- IsIterableContainingInOrder
- .contains(expectedMap.entrySet().toArray()));
+ assertThat(map.entrySet(), IsIterableContainingInOrder
+ .contains(expectedMap.entrySet().toArray()));
}
}