This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
when i run test case i got the following error while same is working with eclips. Java Web application. junit 4.8.2 Compiling 1 source file to E:\cheapCaribbean\build\test\classes E:\abc\test\junit\com\abc\data\RoomManagerTest.java:50: cannot find symbol symbol : method getNameByID(int) location: class com.abc.data.RoomManager String result = instance.getNameByID(id); 1 error E:\abc\nbproject\build-impl.xml:1063: The following error occurred while executing this line: E:\cheapCaribbean\nbproject\build-impl.xml:260: Compile failed; see the compiler error output for details. BUILD FAILED (total time: 1 second) RoomManagerTest.java public class RoomManagerTest { public RoomManagerTest() { } @BeforeClass public static void setUpClass() throws Exception { } @AfterClass public static void tearDownClass() throws Exception { } @Before public void setUp() { } @After public void tearDown() { } /** * Test of getNameByID method, of class RoomManager. */ @Test public void testGetNameByID() { System.out.println("getNameByID"); int id = 5840; RoomManager instance = new RoomManager(); String expResult = ""; String result = instance.getNameByID(id); assertEquals(expResult, result); } }
RoomManager.JAVA public String getNameByID(int id){ return HibernateUtil.currentSession().createCriteria(Room.class) .setProjection(Projections.property("title")) .add(Restrictions.eq("id", id)).list().get(0).toString(); }
when i run this program after creating new project it works fine but create project using existing source gives me same error.
I created java project with existing sources on NetBeans 7.0.1. I used your code, the only difference is that getNameByID(int id) returns empty string by default. The test case run successfully without any error. Closing the issue as worksforme. Please feel free to reopen in case if you still experience the problem. Please attach the whole files, may be there is some error in the java code that causes the issue.