473,698 Members | 2,071 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ClassCastExcept ion in junit 4.5 AllTests

7 New Member
I downloaded Junit 4.5 and am using the TestRunner class to test the AllTests class in the junit/tests package. I am issuing the following command at a DOS prompt:
java -classpath junit-4.5.jar;. junit.textui.Te stRunner junit.tests.All Tests

I get an Error:
java.lang.Class CastException: class junit.tests.All Tests

These classes are already compiled though.
Any help would be appreciated.
Nov 17 '08 #1
4 4079
JosAH
11,448 Recognized Expert MVP
That's a runtime error: your code tries to cast an AllTests object to something
else but it can't do that. Without seeing your code we can't say much more.

kind regards,

Jos
Nov 17 '08 #2
eazyigz
7 New Member
There is not code to see. Simply because I'm tesing my Junit installation. Hence, there is no code to show.
Jan 23 '09 #3
jkmyoung
2,057 Recognized Expert Top Contributor
Just tried downloading it and got the same message. I don't get this with JUnit 4.0. Probably an environment variable out of place somewhere.
By any chance do you have multiple JUnit installs on your computer?
Jan 23 '09 #4
Pradip1632
1 New Member
Try this..

java -classpath junit-4.5.jar;. org.junit.runne r.JUnitCore junit.tests.All Tests
Jul 15 '10 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

0
5557
by: Captain | last post by:
How do you junit test a container managed security (2.3. Servlet) environment within Tomcat 4.1.x using JUnit?? I.e. form based authentication. I had expected the following to work... but alas no: response.sendRedirect(response.encodeRedirectURL("/struts/j_security_check?j _username=myuser&j_password=mypass&j_target_url=/struts/secure/admin.jsp")); Where:
0
3090
by: Linus Nikander | last post by:
Browsing peoples comments at amazon might be rewarding, but it sure takes a lot of time. I'm trying to find good (best) books for a couple of java-related areas. As most people who subscribe to this newsgroup probably have a bunch of books at home this should be the ideal place to ask for recommendations. So, what are your recommendations for good books on any/all of the following subjects: J2EE Patterns Struts JUnit (or testing in...
0
1565
by: Jake | last post by:
I am using ant 1.5.4 I have optional.jar in $ANT_HOME/lib (the one that was distributed with said version of ant) so for example with regards to junit I have junit.jar in $ANT_HOME/lib there appears to be references to junit in the optional.jar I have searched around on the web but maybe I am looking up the wrong tree- decided to tear my hair out instead.
3
2425
by: Jon-Paul Dobson | last post by:
Hi, We have an applet that implements the MouseListener interface but when trying to add the applet to the glasspane of another applet a classcastexception is thrown. This all seemed to work fine when using JDK1.3.1_08 but since using JDK1.4.2 it does not work. The class implementing the mouse listener interface is defined using:
5
5901
by: Casper B | last post by:
Since I am only able to pass simple beans around using my Web Service framework, I wonder how to incorporate business logic around these beans. My idea was to let my Beans be the base class and simply extend these with more sophisticated classes with the nessesary business logic inside. However, when I do a cast from MyObjectBean to MyObject I get a ClassCastException. Is it not possible to cast in this direction? public class...
3
5257
by: knightsmastergeneral | last post by:
Hi, I'm currently working on getting junit and junireport to take some java files, convert it to xml and then display error messages / success rates etc in html which is one of the features of junitreport. I created a simple Math.java class which contains: package test; public class Math { public int add(int a, int b) { return a + b; }
2
2016
by: star111792 | last post by:
helo all, i am working with JSP and EJBs. i have written a simple code for verifying username and password of user by using session beans. my problem is that i m getting exception named "ClassCastException". Exception is as follows: type Exception report message
1
1851
by: Abhishek Bhatt | last post by:
Ours is a J2EE project(JSP, Struts, EJB, Websphere). One of the requirement of our project is to implement Junit without Cactus framework. We have implemented Junit with Cactus framework. Can someone explain how to implement Junit without cactus framework?
1
2087
by: kokababu | last post by:
HI, I am new in Junit testing. I don't know how to test EJB with Junit. I have found people using mock object to test EJB, I am not clear about it. Can anyone give me some advice from where I should begin? and any good tutorial for EJB testing, using JUnit? Thanks
0
8672
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8600
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9155
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8858
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7711
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5859
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4360
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3038
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
1997
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.