Skip to content

Refactoring Test Suite

Raffi Khatchadourian edited this page Dec 19, 2017 · 1 revision

Limitations

Currently, the refactoring test suite helper() method requires a String that represents the stream creation expression. This string must be unique, meaning that in A.java, each stream to be tested must be uniquely created.

Although this is a current limitation of the testing harness, it is often easy to vary the stream creation expression by simply changing variable names. For example:

class A {
	@EntryPoint
	void m() {
		new HashSet().stream().count();
	}
	
	@EntryPoint
	void n() {
		new HashSet().stream().count();
	}
}

would be illegal. However, it can be changed to:

class A {
	@EntryPoint
	void m() {
                HashSet h1 = new HashSet();
		h1.stream().count();
	}
	
	@EntryPoint
	void n() {
                HashSet h2 = new HashSet();
		h2.stream().count();
	}
}

Now, the two streams can be distinguished by their creation strings "h1.stream()" and "h2.stream()", respectively.

Clone this wiki locally