Difference between thenAccept and thenApply

I'm reading the document on CompletableFuture and The description for thenAccept() is Returns a new CompletionStage that, when this stage completes normally, is executed with this stage's result as the argument to the supplied action. and for ...
more »

2017-07-18 20:07 (1) Answers

Passing Parameters into a TestNG XML

I'm using a combination of Maven with TestNG to run my automation tests and for each test/test set, I currently have a separate TestNG XML file for the same. My issue is when it comes to scalability. How can I reduce the number of TestNG XML files us...
more »

2017-07-18 20:07 (0) Answers

How to map JSON (custom)

I'm a beginner and I need to sort from a JSON to be analyzed later. I need to know the JSON fields and if it has arrays or subcategories. I have to map JSON input, for example: { "car":"Audi", "model":"2010", "price":"30000", "colors":...
more »

2017-07-18 19:07 (1) Answers

Loading classes and resources in Java 9

I was reading this article on InfoQ quoting Reinhold: Developers can still use the Java class path in Java 9 for the Java runtime to search for classes and resource files. It's just that with Java 9's modules, developers no longer need the cl...
more »

2017-07-18 14:07 (1) Answers

Condition handling the smart way

if (lineStyle == 5 || lineStyle == 21 || lineStyle == 82 || lineStyle == 83 || lineStyle == 3) { lineStyleString = "DOUBLE"; } else if (lineStyle == 6 || lineStyle == 35 || lineStyle == 39 || lineStyle == 30) { lineStyleString = "DOTTED" ; } ...
more »

2017-07-18 12:07 (9) Answers

Build failure [error] 15669

I have a test project for a web site and I'm using maven. When I'm running maven test in Eclipse it works fine but it fails when I launch "maven test" command line. Here is the pom.xml file <?xml version="1.0" encoding="UTF-8"?> <project ...
more »

2017-07-18 11:07 (2) Answers

How to simplify groovy loop code

I have an groove code (with some java style elements) dates.forEach new Consumer<Period>() { @Override void accept(Period period) { println period } } Is it possible to do it simpler? I would like to have something like ...
more »

2017-07-17 15:07 (2) Answers

Can a separate thread change static variable?

After surfing the web, I am still confused about the following thread behavior. I am aware that static variables are shared within the same classloader, however there's sth definitely missing in this extract: public class parallelCounter { publi...
more »

2017-07-17 14:07 (5) Answers

Cannot mock final Kotlin class using Mockito 2

I am unable to mock a Kotlin final class using Mockito 2. I am using Robolectric in addition. This is my test code: @RunWith(RobolectricTestRunner.class) @Config(constants = BuildConfig.class, sdk = 21) public class Test { // more mocks @...
more »

2017-07-17 13:07 (2) Answers

Deep understanding of volatile in Java

Does Java allows output 1, 0? I've tested it very intensively and I cannot get that output. I get only 1, 1 or 0, 0 or 0, 1. public class Main { private int x; private volatile int g; // Executed by thread #1 public void actor1(){ ...
more »

2017-07-17 00:07 (3) Answers

Stop Win+R from opening run tool

In my javafx program is a popup which lets user press keys and then it sets label accordingly. My problem is with key combinations that are shortcuts for underlying OS for example if user presses Win+R then Run.exe starts but my program should just s...
more »

2017-07-16 22:07 (0) Answers