Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » Syntax error on token "package", assert expected(MyScrapBook error)
Syntax error on token "package", assert expected [message #1338998] Wed, 07 May 2014 13:15 Go to next message
John Nivard is currently offline John NivardFriend
Messages: 1
Registered: May 2014
Junior Member

I recieve the following error after "Inspect"of my scrapbook and I can not find the sollution.! I did add the import Assert in the source and the junit.framework.Assert in the import for MyScrapBook, but it is not helping

error I see: Syntax error on token "package", assert expected

package nl.visionfactory.www;
import java.util.ArrayList;
import junit.framework.TestCase;
import junit.framework.Assert;

class MyLibraryTest {

private Book b0;
private Book b1;
private Book b2;
private Person p0;
private Person p1;
private Person p3;
private MyLibrary ml;
//test the constructor for this library
public void testMyLibrary(){
ml = new MyLibrary ("Test");
assertTrue(ml.books instanceof ArrayList);
assertTrue(ml.people instanceof ArrayList);
Re: Syntax error on token "package", assert expected [message #1339824 is a reply to message #1338998] Wed, 07 May 2014 21:23 Go to previous message
Nitin Dahyabhai is currently offline Nitin DahyabhaiFriend
Messages: 4046
Registered: July 2009
Senior Member

The scrapbook isn't meant to contain an entire source file, just statements as would be within a method. Put this into a normal class and inspect the result of new nl.visionfactory.www.MyLibraryTest().testMyLibrary() instead.

Nitin Dahyabhai
Eclipse Web Tools Platform
Previous Topic:Eclipse and JRE
Next Topic:Need Help !! the emulator crashes !!
Goto Forum:

Current Time: Tue May 18 09:07:08 GMT 2021

Powered by FUDForum. Page generated in 0.02893 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top