Modify

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#12508 closed defect (fixed)

Exception in `MoveCommandTest` and others

Reported by: bastiK Owned by: team
Priority: normal Milestone: 16.02
Component: Unit tests Version:
Keywords: junit fixture Cc: Don-vip

Description

I get a NPE when running the MoveCommandTest and similar tests with Netbeans:

Testcase: equalsContract(org.openstreetmap.josm.command.MoveCommandTest):	Caused an ERROR
null
java.lang.NullPointerException
	at org.openstreetmap.josm.data.preferences.IntegerProperty.get(IntegerProperty.java:26)
	at org.openstreetmap.josm.gui.layer.OsmDataLayer.<init>(OsmDataLayer.java:135)
	at org.openstreetmap.josm.command.MoveCommandTest.equalsContract(MoveCommandTest.java:21)


Test org.openstreetmap.josm.command.MoveCommandTest FAILED

Looks to me as if Main.pref is indeed not initialized. What am I missing?

Attachments (0)

Change History (4)

comment:1 Changed 3 years ago by Don-vip

Probably the test needs fixture to be run independently. On Jenkins, all tests share the same JVM state, so if a test creates a fixture, it is reused by tests run after. I may have missed some fixtures in the tests I wrote recently.

Last edited 3 years ago by Don-vip (previous) (diff)

comment:2 Changed 3 years ago by Don-vip

Keywords: junit fixture added
Milestone: 16.02

comment:3 Changed 3 years ago by Don-vip

Resolution: fixed
Status: newclosed

In 9761/josm:

fix #12508 - add missing fixtures for command unit tests

comment:4 Changed 3 years ago by bastiK

In 9763/josm:

see #12508 - add missing fixtures for unit test

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain team.
as The resolution will be set.
The resolution will be deleted.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.