Question about writing Junit test for SQLj application

Just inherite a SQLj application without unit test. After making few enchancement I plan to add unit test about it to make it more solid. What I plan to do is invoke SQLj translator dynamically to generate java source, then compile and invoke the result class dynamically at Junit test. Does anyone how to call SQLj translator as an API call ??

I guess I might add that the error I am getting is
java.lang.nullPointerException
i've got this now:
     public E top() throws EmptyStackException {
          if (numItems == 0)
               throw new EmptyStackException("Stack is empty");
          return S[numItems--];
     }With the same test, as it would throw an emptystackexception not a full..
But the test still doesn't pass.

Similar Messages

  • Getting error while writing JUnit test case for RestFul Services

    Hi All,
    I have written Restful services in Netbean 6.8.
    It's running well...no issues.
    {color:#0000ff}While writing JUnit test cases for them, I am getting following error:
    {color}{color:#993300}Testcase: testGetAuthenticated(com.ct.services.LoginServicesTest): Caused an ERROR
    Implementing class{color}
    java.lang.IncompatibleClassChangeError: Implementing class
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
    at java.net.URLClassLoader.access$000(URLClassLoader.java:56)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:303)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:316)
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
    at java.net.URLClassLoader.access$000(URLClassLoader.java:56)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:303)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:316)
    at org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactory(PersistenceProvider.java:160)
    at org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactory(PersistenceProvider.java:65)
    at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:52)
    at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:34)
    at com.ct.services.LoginServices.getAuthenticated(LoginServices.java:205)
    at com.ct.services.LoginServicesTest.testGetAuthenticated(LoginServicesTest.java:84)
    Test com.ct.services.LoginServicesTest FAILED
    F:\NetbeanProjectsWorkspace\DemoProject\nbproject\build-impl.xml:972: Some tests failed; see details above.
    BUILD FAILED (total time: 11 seconds)
    {color:#0000ff}Strange thing is that when I am commenting below lines and its related calls:
    {color}
    {color:#ff0000}EntityManagerFactory mEmf = Persistence.createEntityManagerFactory("AnyName");
    EntityManager mEm = mEmf.createEntityManager();
    {color}
    {color:#0000ff}from my code, JUnit test cases are working fine.
    {color}Anybody having any idea about this ?
    Thanks
    Avi
    Edited by: Avi007 on Aug 28, 2010 5:17 AM

    Hi All,
    [http://stackoverflow.com/questions/2778295/test-driven-development-problem]
    Please refer the above link for the solution
    Thanks
    Avi
    Edited by: Avi007 on Aug 30, 2010 12:33 AM

  • Question about lead in music for podcasting.

    Question about lead in music for podcasting.
    I listen to many other podcasts and there are those which play lead in music with bit of music inside their podcast. The music are songs we all know and enjoy. I have notice that they only play short small clips of these songs and are not royalty free songs.
    My Question would be is there a limit of time which you can play any song with out paying for it and use it in a podcast legally.
    Thanks Mike

    Legally you cannot use copyright music without written permission or a licence from a recognized authority, no matter how short the clip. Many people do this and get away with it (and for full tracks too) and it's debatable how much notice anyone is likely to take, or whether they would be bothered about a short clip. But the legal position is, it's not legal.

  • Question about the Filter type for the trace provide "Microsoft-Windows-Kernel-File"

    Hello all,
    I have moved this question from the Windows
    Server General Forum accorfing to the suggestion from Mr. Justin Gu 
    I have a question about the Filter function for the trace provider "Microsoft-Windows-Kernel-File".
    I can find the Filter function with the following operation.
    Mr. Justin Gu wrote:
    > You create a Data Collector Set for the trace provider "Microsoft-Windows-Kernel-File" and finish completely, then you > can right click it and select Properties.
    In the Properties dialog box, click Filter and
    then select ‘Edit…’. You will be> able
    to see the Filter type and Filter data in the Filter dialog box.
    What
    Kind of Filter can
    I use in this Filter dialog box?
    And, how can I set to exclude the some kind of datas?
    Could you give me your suggestion?
    Thank you.

    What
    Kind of Filter can
    I use in this Filter dialog box?
    And, how can I set to exclude the some kind of datas?
    Could you give me your suggestion?
    Thank you.
    I'm looking for the same information.

  • Oracle Functional Testing for Web Applications for Oracle Apps

    I am trying to test Oracle Application 11i and R12 using Oracle Functional Testing for Web Applications.
    In 11i:
    If i open any forms then then the Application is getting crashed whereas it's recording the html events.
    In R12:
    If i open any forms then the Form is getting opened but it's not recording the events happening on the forms
    whereas it's recording the html events.
    Please let me know whether Oracle Functional Testing for Web Applications supports can be used to test Oracle Apps 11i/R12 including the Forms.
    Regards,
    Arun

    Hi,
    AFAIK, there is no official document which states that "Oracle Functional Testing for Web Applications" is certified with Oracle E-Business Suite 11i/R12. I assume it should work with Forms 10g but not with Forms 6i, so it should work (does not mean it is certified) with R12.
    I would suggest you log a SR and confirm this with Oracle Support.
    Regards,
    Hussein

  • Performance Test For WDA Applications

    Hi All,
        Is there a way to check the performance check of the entire Web dynpro For ABAP applications as we do it in the ABAP programs. Sorry for this silly question but i am so curious to learn how efficient we can develop a good efficient and high performance applications.
    Thanks,
    Selvakumar M.

    http://help.sap.com/saphelp_erp2005/helpdata/en/43/4e335b3d1d1bcde10000000a1553f7/frameset.htm
    http://help.sap.com/saphelp_nw2004s/helpdata/en/5e/b29046859d48d68af26c16c75d4a89/frameset.htm
    Abhi
    Edited by: Abhimanyu Lagishetti on Jun 26, 2008 8:43 AM

  • Unit test for J2EE application

    I am writting a Unit test for One J2EE application. The Application is built in such a way that makes unit testing extremely difficult.
    There are 2 things that contribute to the mess.
    1. Sping integration means all the config files are specified in web.xml independently, even though their beans rely on each other across files. End result is in a unit, I cannot try to load a bean because some of its dependencies are missing (ie. they are in a config file that the first file does not include). For this I tried to use AbstractDependencyInjectionSpringContextTests class to set the Spring Application Context when you are not in the flow but didn't success ed.If any one has use this please post the example.
    2. The application is using Errors interface of package org.springframework.validation. To write a test for any validator class you have to pass the object of Error in the validate method with the command object. Now my question is how you can set this Error object when you are not in the flow. For this I tried to use Mock object e.g Errors error;
    Mockery context = new Mockery();
    final Errors errorMock =context.mock(Errors.class);
    //call the validate object with mock object
    classObject.doValidate(cmdObject, errorMock)
    This thing doesn't work. It gives me below error message.
    unexpected invocation: errors.pushNestedPath("")
    no expectations specified: did you...
    - forget to start an expectation with a cardinality clause?
    - call a mocked method to specify the parameter of an expectation?
    Is there any way to get around these hiccups programmatically in unit tests?
    thanks...

    If you are doing unit testing, try to use straight JUnit4 without involving the Spring framework. Given that you do unit testing, you might not need Spring configuration in your unit test at all. You can programmatically instantiate the instance of the class under testing and either programmatically instantiate collaborating objects, or create mock objects for that purpose. If you are doing functional testing, you might need a Spring context after all. Understand that your tests are running in the different context than the complete application, so you would have to create separate application context for your test(s). You might have to go through the existing Spring configuration modules that you created for your application and re-jiggle them a bit so that they can be included both in your application context and your unit test context.
    Hope this helps.

  • Question about required workshop classes for OCP

    Im working on finishing up my OCP in a few months. Quick question about the workshop class. Is there a test at the end of the week?
    Also how do most people pay for these classes? They are pretty steep and my company doesnt pay for stuff like this for me. Im paying totally out of my own pocket. Also why is the online class the same amount as the instructor lead class? Its not like im in a room at some building that Oracle has to lease for use or something.

    RedDeuce wrote:
    Im working on finishing up my OCP in a few months.What Certificate exactly are you working towards?
    Also how do most people pay for these classes? They are pretty steep and my company doesnt pay for stuff like this for me. Im paying totally out of my own pocket.Then talk to your employer again or maybe look for other jobs that support your plan better.
    Also why is the online class the same amount as the instructor lead class? Its not like im in a room at some building that Oracle has to lease for use or something.They know that you might save on expenses for travel and hotel etc.

  • Writing JUnit test app to test a method which uses AppResources

    Recently I was given a requirement to write a JUnit class( with main) to test a method in a Processor class which is running in weblogic. But this method in processor class makes use of AppResources like this: AppResources appResources = new AppResources("ApplicationResources"); String ruleFileName = appResources.getResourceString("rule.file.irlfile"); But when I try to run my JUnit test (stand alone app with main class) I am getting "java.util.MissingResourceException: Can't find bundle for base name ApplicationResources" exception. The appResources is null... Any ideas how to work around this problem?

    It doesn't sound like the Process class was designed for testability outside of its J2EE server container, probably. So writing a unit test for it, under its current design, may be an exercise in futility. You might want to look into "Cactus" tests (search for JUnit Cactus on the web), to test it in its container. Or, redesign the class for testability, separating its business logic better (that's a lot of work to do though) so that it can be instantiated and exercised independently of its environment.

  • Question about source system copy for BW

    Dear all,
    I have a quick question about copying a source system for BW.
    We have two clients in the source ERP:
    100 Customizing
    200 Testing
    Our BW is only linked to client 200, so when we now delete client 200 and make a copy from 100 to 200, are we then still able to restore the source system connection so that our extraction will work, or will it fail, as in client 100 I have no BW related (except the cross-client-objects like datasource) information, that can be used for a possible restore of this connection.
    What is the procedure in this case?
    Thanks,
    Andreas

    Unfortunately, you will lose your source connection and need to create a new one in R/3.  You can use the same source system name in BW, but check the source system connection after the copy (SM59).  Also, I would "Restore" the source system (in BW, right-click on Source system in RSA1, and click "Restore") to insure the datasources get replicated from R/3 to BW.
    Depending on how much you want your BW and R/3 systems to be in synch, you will need to rebuild all your data providers (cubes/ODS's) from your R/3 system.  This means deleting all the data and running the initializations from scratch.  At the very least, you will need to rebuild the delta queues.
    Curious, if 100 is just for customizing, is there any data in it?  Are you just creating a new blank client 200?

  • Junit testcase for struts application

    Hi All,
    can anyone provide me the Junit sample testcase for struts application.

    > can anyone provide me the Junit sample testcase for struts application.
    The test code for the framework is downloadable with the source:
    http://struts.apache.org/download.cgi#struts208
    If you want unit tests for your web app, you'll need to write those yourself. Plenty examples can be found with Google:
    http://www.google.com/search?q=unit+test+struts
    ~

  • Performance and Load testing for Agentry applications in SMP2.3

    Hello Experts,
    We have a requirement to carry out the Performance and Load testing for our SAP Work Manager application (SMP2.3).
    Please guide me if ATE (Agentry Test environment) /  Jmeter / or any other testing tool can be utilized for the same.
    Would be great if you could provide me the steps / references for the same.
    Thanks,
    Abhishek

    Hi Abhishek,
    Please refer this document Agentry - Assets for Admins & Architects. It has very good content which explains about performance testing and performance tuning.
    Rgrds,
    Jitendra

  • Re: junit test for entity beans ... ejb 3.0

    I'm confused. I'm trying to test my entity bean.
    I have:
    - an entity bean
    - a stateless session bean for accessing the entity bean (facade)
    - an interface for accessing the the stateless bean
    And I'm trying to write a JUnit test class to test this bean. However, I am uncertain as to how to test this (I'm new to EJB 3.0, JBoss and Eclipse).
    What would the JUnit test look like? I'm confused as to whether or not I should be injecting the interface/bean/what???
    I've tried several variations. I either get "NameNotFound" - not bound exceptions or Null pointer exceptions.
    What would the @EJB syntax look like or how would I do it through the context?
    For Example:
    @EJB private TestFacade myTest; //interface to stateless bean ?
    OR
    InitialContext ctx = new InitialContext();
    TestResultFacadeBean myTest = (TestResultFacadeBean) ctx.lookup("localTest");
    I'm confused at to which method I should be using and what object I should be accessing. If I could get either one to work, I'd be happy. :)
    How do I ensure my bean is deployed to the container? What do I need to do?
    If anyone has a simple example or explanation as to which method I should use and how to use it, I'd be very grateful.
    Thanks very much,
    LisaD

    OK, you need to have several layers of testing.
    Layer 0. Test the entity beans are deployable (more on this later). Basically, you need to know that all your annotations work. Things to watch out for are multiple @Id fields in one class or @EmbeddedID or @IdClass in conjuction with @ManyToOne, @ManyToMany, @OneToMany, @OneToOne and fun with @JoinTable, @JoinColumn and @JoinColumns. Once you know how these are supposed to work with the spec, it's not too bad to write it correctly each time. But there are some gotchas that will break things later on.
    Layer 1. Do the functions in the classes that don't depend on annotations work as expected. Typically, this is just going to be the getters and setters in your entity classes. Of course JUnit best practice says we don't bother testing functions that look like:
    public T getX() {
    return this.x;
    or
    public void setX(T x) {
    this.x = x;
    as there is nothing that can go wrong with them. So in that case, your level 1 tests will just be initial values specified from constructors and verifying that the non-get/set pairs work, and that the getters you have tagged @Transient work (because you've likely put some logic in them)
    Layer 2. Test the session bean methods that don't require injection to work.
    Layer 3. Test the session bean methods that require injection (Mock Objects). Simulate the injection for yourself, injecting Mock Objects for the entity manager. Then you can confirm that the correct methods are being called in the correct sequences, etc.
    [Note this may require some skill in designing the mock.  I'm working on developing my own entitymanager mock, and if it looks usefull I'll release it to the world.
    Layer 4. Test the session bean methods that require injection (Real entity manager) (See Layer 0)
    For this you will need an out of container persistence implementation.  Currently Hibernate and Glassfish provide beta versions.  You will need a different persistence.xml file that lists all the entities.  You will have to use reflection to inject the entity manager(s) that you create from an entity manager factory unless you provide a constructor that takes an EntityManager as a parameter.  You may need to use reflection to call any @PostConstruct method if you made it private.
    Layer 5. Navigate the relationships in the objects returned from Layer 4 using a database that has been loaded with test data.
    I am currently using Layers 0, 1, 2 & 4 to test my session beans and entity beans.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Require Help on Load Testing for Oracle Applications

    Hi,
    I have to do a Load Testing on Oracle Application 11i. I am not able to understand from where do I need to start.
    Could any one please help on this ?
    Ramu.

    The tool which I am using for this is "Oracle Application Testing Suite".
    Any help welcome !
    Ramu

  • Some question about Toshiab reocvery disk for Satellite P300-133

    Hello guys ,
    I got some questions about unpleasant recovery surprises :
    *1)* I just made recovery DVD using Toshiba Recovery Disk Creator and it initially asked for 2 DVDs - but when the first one was done it didn`t require a second blanc DVD . Is it possible all system files of Windows Vista to be written on 1 DVD ?
    *2)* Could I reinstall Windows Vista using the HDD Recovery option ( by pressing F8 ) without using recovery DVD ?
    *3)* Which HDD partitions`ll be formatted ( just system C: or both C: and E: ) using HDD recovery ?
    *4)* What is recovery DVD - Image of the hard drives or Vista installation files ?
    Its pretty bad idea not to include OS on DVD when I have paid for it.
    Thanks for all the problems to Toshiba :(

    1. I think the recovery disk creator means 2 CDs. I have a Portege M700 with Windows Vista and one DVD too. I recovered it and after this I have a clean Vista installation with all drivers and tools from Toshiba. Nothing is missing.
    2. Yes, you can reinstall Vista using the HDD Recovery option when you press F8 at startup. You dont need the recovery DVD but you should create one when your HDD get some errors or something else. If you need a new Recovery DVD, you have pay for one.
    3. The complete HDD and partitions will be formatted, so backup your data first on a DVD, external HDD, USB stick or something else.
    After the reinstallation you have the factory settings.
    4. The recovery DVD is an image of the HDD about the factory settings. If you make a recovery, there are all drivers and tools already installed. Of course on the disk are the installations files of Vista, but you can only use this DVD on your Satellite P300. The disk can not be used on an other Satellite or on a PC.
    When you have more questions, have a look in the user manual. There are a many in formations about the recovery. Its in chapter 3.

Maybe you are looking for