When you got the following error:
java.lang.NoSuchMethodError: org.hamcrest.Matcher.describeMismatch(Ljava/lang/Object;Lorg/hamcrest/Description;)V
at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:18)
at org.junit.Assert.assertThat(Assert.java:956)
at org.junit.Assert.assertThat(Assert.java:923)
at org.junit.rules.ExpectedException.handleException(ExpectedException.java:252)
at org.junit.rules.ExpectedException.access$000(ExpectedException.java:106)
at org.junit.rules.ExpectedException$ExpectedExceptionStatement.evaluate(ExpectedException.java:241)
at org.junit.rules.RunRules.evaluate(RunRules.java:20)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecuter.runTestClass(JUnitTestClassExecuter.java:86)
at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecuter.execute(JUnitTestClassExecuter.java:49)
at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassProcessor.processTestClass(JUnitTestClassProcessor.java:69)
at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.processTestClass(SuiteTestClassProcessor.java:48)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
at org.gradle.messaging.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:32)
at org.gradle.messaging.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93)
at com.sun.proxy.$Proxy2.processTestClass(Unknown Source)
at org.gradle.api.internal.tasks.testing.worker.TestWorker.processTestClass(TestWorker.java:105)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
at org.gradle.messaging.remote.internal.hub.MessageHub$Handler.run(MessageHub.java:360)
at org.gradle.internal.concurrent.DefaultExecutorFactory$StoppableExecutorImpl$1.run(DefaultExecutorFactory.java:64)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
try to change `mockito-all` to `mockito-core` as follows:
// testCompile("org.mockito:mockito-all:${mockitoVersion}")
testCompile("org.mockito:mockito-core:${mockitoVersion}")
It worked for me.
Reference:
http://stackoverflow.com/questions/7869711/getting-nosuchmethoderror-org-hamcrest-matcher-describemismatch-when-running
Thursday, April 28, 2016
Thursday, April 21, 2016
Change only cases (uppercase or lowercase) in name of directory in Git
To change only cases in name of directory in Git, do as follows:
git mv "Domain" "domain2"
git mv "domain2" "domain"
git commit
Reference:
http://stackoverflow.com/questions/3011625/git-mv-and-only-change-case-of-directory
git mv "Domain" "domain2"
git mv "domain2" "domain"
git commit
Reference:
http://stackoverflow.com/questions/3011625/git-mv-and-only-change-case-of-directory
Wednesday, April 20, 2016
How to prevent from force push to `master` branch
To prevent from force push to `master` branch, do as follows:
Settings -> Branches -> Protected branches -> master
Check `Protect this branch`.
Reference:
http://stackoverflow.com/questions/7419244/elegant-solution-to-prevent-force-push-on-master-only
Settings -> Branches -> Protected branches -> master
Check `Protect this branch`.
Reference:
http://stackoverflow.com/questions/7419244/elegant-solution-to-prevent-force-push-on-master-only
Find duplicate words in IntelliJ
You can easily find duplicate words in IntelliJ as follows:
`[^(@param)] ([a-zA-Z]+) \1 `
Check `Case sensitive` and `Regular expression`.
`[^(@param)] ([a-zA-Z]+) \1 `
Check `Case sensitive` and `Regular expression`.
Monday, April 18, 2016
Extract a specifc parameter value from HTTP log and calculate unique count
To extract a specifc parameter (say `name`) value from HTTP log and calculate unique count,
use the following command:
cat logs/http/http.log.2016-04-17.? | grep -o -P '(?<=name=)[^&]*(?=&)'
Reference:
http://stackoverflow.com/questions/13242469/how-to-use-sed-grep-to-extract-text-between-two-words
use the following command:
cat logs/http/http.log.2016-04-17.? | grep -o -P '(?<=name=)[^&]*(?=&)'
Reference:
http://stackoverflow.com/questions/13242469/how-to-use-sed-grep-to-extract-text-between-two-words
Sunday, April 17, 2016
Remove Git branches with `*` (asterisk)
To remove Git local branches with `*`, you can do as follows:
git branch | grep "polish" | xargs git branch -D
To remove Git remote branches with `*`, you can do as follows:
git branch | grep "polish" | xargs git push origin --delete
References:
http://stackoverflow.com/questions/3670355/can-you-delete-multiple-branches-in-one-command-with-git
http://stackoverflow.com/questions/2003505/delete-a-git-branch-both-locally-and-remotely
git branch | grep "polish" | xargs git branch -D
To remove Git remote branches with `*`, you can do as follows:
git branch | grep "polish" | xargs git push origin --delete
References:
http://stackoverflow.com/questions/3670355/can-you-delete-multiple-branches-in-one-command-with-git
http://stackoverflow.com/questions/2003505/delete-a-git-branch-both-locally-and-remotely
Saturday, April 16, 2016
How to avoid `Enter PEM pass phrase:` in Nginx
To avoid `Enter PEM pass phrase:`, add the following to `conf/nginx.conf`:
ssl_password_file /home/izeye/global.pass;
Reference:
http://nginx.org/en/docs/http/ngx_http_ssl_module.html#ssl_password_file
ssl_password_file /home/izeye/global.pass;
Reference:
http://nginx.org/en/docs/http/ngx_http_ssl_module.html#ssl_password_file
Thursday, April 14, 2016
How to get annotations from Java class file
To get annotations from Java class file, you can use the following command:
$ javap -v -cp ./build/classes/test/ learningtest.com.fasterxml.jackson.databind.lombok.LombokAllArgsConstructorDomain | grep ConstructorP
#47 = Utf8 Ljava/beans/ConstructorProperties;
$
Reference:
http://stackoverflow.com/questions/3933119/how-to-view-annotation-of-java-classfile-via-command-line
$ javap -v -cp ./build/classes/test/ learningtest.com.fasterxml.jackson.databind.lombok.LombokAllArgsConstructorDomain | grep ConstructorP
#47 = Utf8 Ljava/beans/ConstructorProperties;
$
Reference:
http://stackoverflow.com/questions/3933119/how-to-view-annotation-of-java-classfile-via-command-line
Tuesday, April 12, 2016
net::ERR_CERT_AUTHORITY_INVALID
If you encounter the following error with a self-signed certificate in Google Chrome:
Certificate Error
There are issues with the site's certificate chain (net::ERR_CERT_AUTHORITY_INVALID).
do the following instructions:
Click broken lock icon and then click `Certificate information`.
Export it to a file.
Settings -> Show advanced settings... -> Manage certificates...
Add the certificate as a trusted root CA.
Select `Exit`. (Note this is a key part to apply the change.)
Certificate Error
There are issues with the site's certificate chain (net::ERR_CERT_AUTHORITY_INVALID).
do the following instructions:
Click broken lock icon and then click `Certificate information`.
Export it to a file.
Settings -> Show advanced settings... -> Manage certificates...
Add the certificate as a trusted root CA.
Select `Exit`. (Note this is a key part to apply the change.)
the "ssl" parameter requires ngx_http_ssl_module
If you encounter the following error in Nginx:
nginx: [emerg] the "ssl" parameter requires ngx_http_ssl_module in /home/izeye/programs/nginx/conf/nginx.conf:99
add `--with-http_ssl_module` when running `./configure` as follows:
./configure --prefix=/home/izeye/programs/nginx --with-http_ssl_module
Reference:
https://www.nginx.com/resources/wiki/start/topics/tutorials/installoptions/
nginx: [emerg] the "ssl" parameter requires ngx_http_ssl_module in /home/izeye/programs/nginx/conf/nginx.conf:99
add `--with-http_ssl_module` when running `./configure` as follows:
./configure --prefix=/home/izeye/programs/nginx --with-http_ssl_module
Reference:
https://www.nginx.com/resources/wiki/start/topics/tutorials/installoptions/
13: Permission denied
If you encounter the following error in Nginx:
2016/04/12 15:32:47 [error] 148862#0: *117 "/home/izeye/programs/nginx/html/index.html" is forbidden (13: Permission denied), client: 1.2.3.4, server: localhost, request: "GET / HTTP/1.1", host: "10.20.30.40"
check if any execution permision on directory is missed.
If `/home/izeye` has no execution permission, use the following command:
sudo chmod o+x /home/izeye
Reference:
http://stackoverflow.com/questions/6795350/nginx-403-forbidden-for-all-files
2016/04/12 15:32:47 [error] 148862#0: *117 "/home/izeye/programs/nginx/html/index.html" is forbidden (13: Permission denied), client: 1.2.3.4, server: localhost, request: "GET / HTTP/1.1", host: "10.20.30.40"
check if any execution permision on directory is missed.
If `/home/izeye` has no execution permission, use the following command:
sudo chmod o+x /home/izeye
Reference:
http://stackoverflow.com/questions/6795350/nginx-403-forbidden-for-all-files
Subscribe to:
Posts (Atom)