https://github.com/yandex-qatools/uri-differ
Simple lib to find diffs between two URIs
https://github.com/yandex-qatools/uri-differ
diff uri
Last synced: 5 months ago
JSON representation
Simple lib to find diffs between two URIs
- Host: GitHub
- URL: https://github.com/yandex-qatools/uri-differ
- Owner: yandex-qatools
- License: mit
- Created: 2014-08-17T20:20:39.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2017-01-19T09:02:30.000Z (over 8 years ago)
- Last Synced: 2025-04-08T15:49:35.335Z (6 months ago)
- Topics: diff, uri
- Language: Java
- Size: 43 KB
- Stars: 11
- Watchers: 2
- Forks: 9
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
URI Differ
===========[](https://github.com/yandex-qatools/uri-differ/releases/latest)
[](https://maven-badges.herokuapp.com/maven-central/ru.lanwen.diff/uri-differ-lib)Simple lib to find diffs between URI and represent it in pretty way.
##Quick start:
### Use maven:
```xmlru.lanwen.diff
uri-differ-lib
1.3.0```
### Add some code:
Get changes:
```java
UriDiff changes = UriDiffer.diff()
.expected("http://ya.ru").actual("http://yandex.ru").changes();
```Print them:
```java
String report = changes.report();
```Use any report generator with implementing `ReportView`:
```java
String report = changes.report(DefaultUrlDiffView.withDefaultView());
```What it returns:
| Expected | Actual | Report |
| ------------------------ | -------------------- | ---------------------------- |
| `httpf://ya.ru` | `httpfs://ya.ru` | `httpf[+s]://ya.ru` |
| `httpfd://ya.ru` | `http://ya.ru` | `http[-fd]://ya.ru` |
| `httpfd://ya.ru` | `httpgt://ya.ru` | `http[fd->gt]://ya.ru` |
| `httpf://ya.ru` | `http://ya.ru` | `http[-f]://ya.ru` |
| `httpf://ya.ru` | `httpg://ya.ru` | `http[f->g]://ya.ru` |
| `htspf://ya.ru` | `httpg://ya.ru` | `ht[s->t]p[f->g]://ya.ru` |
| `htspf://ya.ru` | `httpg://ya.ru/h` | `ht[s->t]p[f->g]://ya.ru[+/h]` |
| `http://ya.ru` | `http://yandex.ru` | `http://[ya->yandex].ru` |
| `http://yandex.ru` | `http://yandex.com.tr` | `http://yandex.[ru->com.tr]` |
| `http://yandex.com` | `http://yandex.com.tr` | `http://yandex.com.[+tr]` |
| `http://yandex.com.tr` | `http://yandex.com` | `http://yandex.com.[-tr]` |
| `http://yandex.com.tr.fr` | `http://yandex.com` | `http://yandex.com.[-tr.fr]` |
| `/path?q=1` | `/changed?q=2` | `/[path->changed]?[q=1->q=2]` |##Use filters:
```java
UriDiffer.diff()
.expected("http://ya.ru").actual("https://yandex.ru/?ncrnd=2342")
.filter(scheme(), param("ncrnd")).changes();
```### Scheme filter:
To ignore any scheme, add filter `SchemeFilter.scheme()`.
You can also specify which schemes are allowed: `SchemeFilter.scheme("http", "https")`.### Parameter filter:
To ignore parameter with some name, just add `AnyParamValueFilter.param("param_name")`.
You can also specify which values only can be ignored: `AnyParamValueFilter.param("param_name").ignore("val1", "val2")`.