I was recently trying to assert the inequality in one of the test. However I wasnt able to find the appropriate matcher in hamcrest.
What I ideally want to do is something like.
assertThat(2 , isNot(3));
Is there any way to do it?
You're almost there:
assertThat(2 , is(not(3)));
Be sure you import it:
import static org.hamcrest.CoreMatchers.not;
Related
Is it possible to add a package in the reflection-config.json?
Something like:
[
{
"name" : "org.apache.tinkerpop.shaded.kryo.serializers.*",
"allDeclaredConstructors" : true
}
}
Instead of doing it one by one.
Thanks :)
As far as I know, that isn't possible yet. There is an open feature request for this: https://github.com/oracle/graal/issues/1236
Probably the best would be to create a Feature class which would register classes for reflection programmatically. Here's a short example: https://www.graalvm.org/reference-manual/native-image/Reflection/#configuration-with-features
The feature class needs to be on classpath then referenced using the --features= command line option.
I am using tracing agent features to auto generate a list for reflection/jni/resources, this should be quite convenient until one day the wildcard features is implemented. (I bet it will not be implemented due to performance concern.)
This seems to be a simple matter and maybe it's solved already, but I'm not sure how to do it. I'd like to keep arbitrary unresolved expressions for later evaluation. Note that I still don't know which expressions are already defined.
For example, suppose I have the expression...
{{source.path}}/mainmenu{{ext}}"
...and the context defines ext as .js, but source.path is still undefined. What I get is/mainmenu.js", but I'd like to get {{source.path}}/mainmenu.js" instead so that I can evaluate {{source.path}} at a later time. HandlebarsConfiguration.UnresolvedBindingFormatter seemed promising, but it doesn't handle the complete original expression. HandlebarsConfiguration.ExpressionNameResolver also didn't help.
So, is it possible to do this at all? Thanks in advance for any help.
I want to know if it is possible to create or call functions to use on snippets in the Atom editor. If possible, how do I do it ? Maybe using lodash or something similar ?
I want to use something like uppercase(), downcase(), filePath().
My problem is that I want to generate something like this line below:
import Hello from 'components/atoms/hello/Hello';
My snippet would be something like this:
import $1 from 'components/atoms/downcase($1)/$1';
Or:
import camelCase($1) from 'components/atoms/$1/camelCase($1)';
This behavior is still an opened issue. So it's seems there is no solution right now for this, sorry.
Here is the issue.
What is the best way to manually make a test case fail in Erlang common test?
I am using something like this:
ok = nok, % fail as soon as possible
to raise a badmatch exception and make the case fail.
I wonder if there are other (better) ways to achieve this?
ct:fail/1 and ct:fail/2 seem to be there for that reason.
No, that's a standard perfectly good way of doing it. An alternative would be to not just fail but to try and generate a more relevant error. For example if the function foo_test() returns ok when successful then an alternative could be to write:
ok = foo_test()
to both test and generate an error. It is still a badmatch error but it is easier to see what went wrong.
I sometimes use the error function:
error(incorrect_foo)
That way I can easily distinguish different causes for failure within the same test case. For example, I might have error(incorrect_bar) somewhere in the same function.
I'm using the skeleton application for ZF2.0.0Beta3.
So, normally I would just use Zend_Debug::dump($someVar); however, in ZF2 it doesn't include the zend classes it seems.
The error is: Fatal Error: Class 'Zend_Debug' not found..
This is probably a really basic question, but what's the best way to include that class? Do I have to put require_once('path/to/Debug.php');?
It still exists in ZF2, but since ZF2 started using PHP namespaces, you would now have to call it using the Zend namespace:
\Zend\Debug\Debug::dump($var);
or add a use statement at the beginning of the file and call it like this:
use Zend\Debug\Debug;
Debug::dump($var);
In my case this was the correct namespace-path :
\Zend\Debug\Debug::dump($form);
Additionally, you can get it like this:
use Zend\Debug\Debug;
// ...
Debug::dump($someVar);
Seems like a lot of work just to dump a variable, though. I'm pretty sure in most case I'll just end up using \Zend\Debug\Debug::dump() more often.
You can use it like that:
\Zend\Debug::dump('asd')