I would encourage you to try to think of the outcome you want to test first and then write some code to make the test pass (TDD). This can help you with developing good interfaces and designing easily understood classes that you may even be able to re-use.
A couple of rules of thumb here are that you want your classes to have one responsibility and your methods to do one thing--in essence, it's the KISS principle, but with some specific design hints. Also, I like to think of tests for behavior rather than tests for methods--it's a subtle difference which I will find difficult to explain!
Here I have a method to test before I have thought about what I really intend for the system to do, so I find it harder to work this way, but I'll share my thoughts. I like to use AssertJ assertions.. I'm just winging this, so it hasn't seen a compiler.
import static org.assertj.core.api.Assertions.*;
...
private TestSubject testSubject = new TestSubject(); // instance of the class under test (you omit the actual class name)
...
@Test
public void should_return_empty_list() {
// Arrange
List<PspTransactionEntity> input = new ArrayList<PspTransactionEntity>();
// Act
List<PspTransaction> mapResult = testSubject.mapToDomainList(input);
// Assert
assertThat(mapResult.size()).isEqualTo(0);
}
@Test(expected=java.lang.NullPointerException.class)
public void should_throw_null_pointer_exception() {
// Act
List<PspTransaction> mapResult = testSubject.mapToDomainList(null);
}
So, I guess I would want tests along those lines if I'm working backwards from the code to the tests. Think of the happy path but also your edge cases like what should happen when you pass null, etc. Does it make sense? Hope it helps!