Create class with script

Is there any way to dynamically create a class in a Flex application with a script?  Basically what I want to do is loop over data from a database that defines the classes I need, and create them on-the-fly instead of creating them in .as files and recompiling.

Class I doubt, but its attributes indeed u can create dynamically by making
public dynamic class TestClass
     public function TestClass()
            this.attribute_1 = value...

Similar Messages

  • Creating Database with Script

    Can any body guide me how to create DB with scripts, Here is the scripts
    ls -ltrtotal 6952
    -rw-r----- 1 oracle oinstall 7061504 Dec 4 11:17 tempControl.ctl
    -rw-r----- 1 oracle oinstall 2057 Dec 4 11:17 rmanRestoreDatafiles.sql
    -rwxr-xr-x 1 oracle oinstall 948 Dec 4 11:17 PSC01P1.sql
    -rwxr-xr-x 1 oracle oinstall 645 Dec 4 11:17 PSC01P1.sh
    -rw-r----- 1 oracle oinstall 682 Dec 4 11:17 postScripts.sql
    -rw-r----- 1 oracle oinstall 2634 Dec 4 11:17 initPSC01PTemp.ora
    -rw-r----- 1 oracle oinstall 2719 Dec 4 11:17 initPSC01PTempOMF.ora
    -rw-r----- 1 oracle oinstall 2621 Dec 4 11:17 init.ora
    -rw-r----- 1 oracle oinstall 185 Dec 4 11:17 CreateClustDBViews.sql
    -rw-r----- 1 oracle oinstall 915 Dec 4 11:17 CloneRmanRestore.sql
    -rw-r----- 1 oracle oinstall 1756 Dec 4 11:17 cloneDBCreation.sql
    -rw-r----- 1 oracle oinstall 954 Dec 4 11:18 postDBCreation.sql

    None of any script will help u. Followings are the steps to create manually database
    Assume you have selected f drive for the same -
    1. Choose drive with sufficient disk space
    2. create folder (folder_name)
    3. create bdump,cdump,oradata,pfile folder in (folder_name) folder
    4. open notepad and create pfile as named "init_sidname.ora" with required parameters (check parameters in sample pfile or ask to resend
    5. go to os prompt
    6. type commands
    oradim -new -sid init_sidname.ora -startmode m -pfile (path of init_sidname.ora file with filename)
    orapwd file=f:\oracle\ora92\database\pwd_nameoffile.ora password=sysdba entries=3
    create a sql script to create database with extention .sql
    set oracle_sid=sid_name
    sqlplus /nologsql>connect sys as sysdba
    password : sysdba
    sql> create spfile from pfile=(path of pfile)
    (it will create spfile in database folder of ora92 folder)
    sql> startup nomount
    sql> execute catalog.sql and catproc.sql scripts
    your database will be create and can be checked with select commands like
    select * from dba_datafiles;
    Rajesh thakur

  • Manually creating DB with scripts question

    As mentioned in admin guide, these are the steps to manually creating DB
    Step 1: Decide on Your Instance Identifier (SID)
    Step 2: Establish the Database Administrator Authentication Method
    Step 3: Create the Initialization Parameter File
    Step 4: Connect to the Instance
    Step 5: Create a Server Parameter File (Recommended)
    Step 6: Start the Instance
    Step 7: Issue the CREATE DATABASE Statement
    I am not sure about step2, can somebody send me quick command what to do here, which are mentioned in
    http://download-east.oracle.com/docs/cd/B19306_01/server.102/b14231/create.htm#i1008823

    C:\Documents and Settings\Ar>set ORACLE_SID=test1
    C:\Documents and Settings\Ar>orapwd FILE=test1.pwd
    PASSWORD=test ENTRIES=30
    = your password file should be named
    = %ORACLE_HOME%\database\orapwORACLE_SID.ora
    C:\Documents and Settings\Ar>sqlplus /nolog
    SQL*Plus: Release 9.2.0.1.0 - Production on Wed May 2
    10:59:01 2007
    Copyright (c) 1982, 2002, Oracle Corporation. All
    rights reserved.
    SQL> connect sys/test as sysdba;
    ERROR:
    ORA-12560: TNS:protocol adapter error
    = First, point to your instance, set the ORACLE_SID environment
    = variable from the OS:
    = set ORACLE_SID=YourInstanceName
    = Next, make sure you use proper authentication method.
    Now how can i run creat database scripts here???= Just before creating your database, in windows, you must first create the service, with the oradim command, this command creates the password file automatically:
    oradim -new -sid YourInstanceName -intpwd YourSYSDBAPassword -startmode A
    = Once you have been properly authenticated, and you had made sure everything is OK, issue your CREATE DATABASE command.
    = I suggest you to use the dbca to create the scripts, this is the easiest way to create the create database scripts, and the least prone to human error.

  • Create triangle with scripting

    Hi,
    does someone know how to create a triangle with (x1,y1)(x2,y2) and (x3,y3) positions?
    For a rectangle i found this:
    app.activeDocument.rectangles.add({geometricBounds:[0, 144 , 214, 500] } )
    But this is not working for a triangle?
    Please Help

    Or:
    create a rectangle and convert it to a triangle with:
    myRectangle.convertShape(ConvertShapeOptions.CONVERT_TO_TRIANGLE);
    Uwe

  • I dont understand creating classes they seem a waste of time and efficiency

    I dont understand why we would want to create classes with constructors and get and set statements... I know that VB and Java did not create these just to have us writing extra code so I am missing something in my thinking.
    I read about data hiding and that I understand I guess...but everytime my professors want me to create a class then create an object from that class to access it I dont really get it. I know how to do the basics of it but I can do all of it in my main or the primary class whats the benefit of creating a whole entire class such as the following?
    Everytime I get an assignment and they are like create a class and I try to rack my head for a good idea but the nearest analogy I can come up with is this... creating your own class seems like one of those old straws you drink out of with all the loops, yes you can make it go around in a big loop but why waste time? you want to get to point A to point B so create the most efficient way to get there if possible.
    I am sure the problem is I am not seeing something and there is some logic missing but I just am getting irritated as I am not seeing it and I am finding it, its like I add an extra obstacle course to my code for no other reason than to run through a bunch of extra tasks that I could perform in my main class or main.
    input is welcome to help me arrive at some type of enlightenment thanks
    Class may not be the correct wording for this as I know we have to have a class but what I mean is a non application class. The class I have below goes with another class that actually does a lot of stuff but I am forced to push data through this class that basically does nothing but run water through some different pipes if you will. To me thats a waste when I can do everything in my original class which was called menu that I am messing with and that creates an array for a user who wants to keep a list of his items and prices of those items in inventory.
    public class Item
    private String itemName;
    private double itemPrice;
              public Item()
    public Item (String item, double price)
    setName(item);
    setPrice(price);
    public String getName()
         return itemName;
    public void setName(String item)
         itemName = item;
    public double getPrice()
         return itemPrice;
    public void setPrice(double price)
         itemPrice= price;
    Edited by: Bricatw on Oct 30, 2009 10:33 PM

    What I was plugging into it and please forgive the code as its not finished... (I am still messing with it) its just for learning and I am required to have certain parts in the Item Class and Certain parts in the Menu class..... But you it pushes through the input to the java bean.... in a case like this I just dont see the need for doing it not that I can think of anyway.
    import java.util.Scanner;//my imports for scanner so can read from the screen
    import java.util.*;//imports for my array I used astrix to just import it all as the book said it does not have any negative affects.
    public class Menu //My application class Menu that contains my main
         public static void main(String[] args)//Main method
              final int NUMBER_Of_Elements = 30; //created a symbolic constant so that I only have to change the constant
              //to edit the size of the array if I should want to change it.
              Item[]inventory = new Item[NUMBER_Of_Elements];//I create a new array object with the constant as the number of elements.
              Scanner sc = new Scanner (System.in);//created object from the scanner class used to get input from the console screen.
              System.out.println("Please enter Item on first line and price on second line.");//outputted text to prompt user and give instructions.
              System.out.println("Enter STOP to exit");//instructions on how to exit the program. I would have rather used a different
              //word than stop here. If my choice I would have used "exit" as its more widely used and to promote uniformity.
              int count;//count variable used to count my loops very important as we use it to control our arrays and loops here.
              double price;//our variable that we plug in values from the user via the console.
              String item;//same as previously mentioned for the "price"
                        System.out.println("Wings Coffee Shop Menu");
              System.out.println("");
              System.out.println("Menu Item Price");
              for (count=0; count<inventory.length; ++count)//This is our for loop it uses the length method to control how many times
              //it runs. In this case inventory.length = 30 elements so would run 30 times unless it stopped early.
                   item = sc.nextLine();//reads the input from console into the item variable.
                   if(item.equalsIgnoreCase("STOP"))//if statement that states if = stop (ignores case sensitivity) then it will break out of the loop.
                   break;//the break command which is executed if the if statement is true.
                   price = Double.parseDouble(sc.nextLine());//
                   inventory[count]= new Item(item, price);
                   Item Call = new Item(item, price);
                   System.out.printf("%-13s %.2f\n", Call.getName(), Call.getPrice());
              System.out.println("Wings Coffee Shop Menu");
              System.out.println("");
              System.out.println("Menu Item Price");
    //           for(int x = 0; x < count; ++x)
    //           System.out.printf("%15s\n",inventory[x].toString());
    //                System.out.printf("%-13s %.2f\n", Call.getName(), Call.getPrice());
    //           String[] namesOfItems = {"Coffee", "Milk", "Soda", "Bagel", "Croissant", "Donut"};
    //           double[] prices = {3.99, 2.99, 2.49, 2.99, 2.49, 1.99};
    //           for(int x = 0; x < prices.length; ++x)
    //           System.out.printf("%-13s %.2f\n", namesOfItems[x], prices[x]);
    //           Item arrayPrice = new Item(); HOW COME I CANNOT CREATE THIS OBJECT?
    //           Item call = new Item ();
    //           Item Call = new Item("item", 4.9);
    Edited by: Bricatw on Oct 30, 2009 11:22 PM

  • Help with Script created to check log files.

    Hi,
    I have a program we use in our organization on multiple workstations that connect to a MS SQL 2005 database on a Virtual Microsoft 2008 r2 Server. The program is quite old and programmed around the days when serial connections were the most efficient means
    of connection to a device. If for any reason the network, virtual server or the SAN which the virtual server runs off have roughly 25% utilization or higher on its resources the program on the workstations timeout from the SQL database and drop the program
    from the database completely rendering it useless. The program does not have the smarts to resync itself to the SQL database and it just sits there with "connection failed" until human interaction. A simple restart of the program reconnects itself
    to the SQL database without any issues. This is fine when staff are onsite but the program runs on systems out of hours when the site is unmanned.
    The utilization of the server environment is more than sufficient if not it has double the recommended resources needed for the program. I am in regular contact with the support for the program and it is a known issue for them which i believe they do not
    have any desire to fix in the near future. 
    I wish to create a simple script that checks the log files on each workstation or server the program runs on and emails me if a specific word comes up in that log file. The word will only show when a connection failure has occurred.
    After the email is sent i wish for the script to close the program and reopen it to resync the connection.
    I will schedule the script to run ever 15 minutes.
    I have posted this up in a previous post about a month ago but i went on holidays over xmas and the post died from my lack or response.
    Below is what i have so far as my script. I have only completed the monitoring of the log file and the email portion of it. I had some help from a guy on this forum to get the script to where it is now. I know basic to intermediate scripting so sorry for my
    crudity if any.
    The program is called "wasteman2G" and the log file is located in \\servername\WasteMan2G\Config\DCS\DCS_IN\alert.txt
    I would like to get the email side of this script working first and then move on to getting the restart of the program running after.
    At the moment i am not receiving an error from the script. It runs and doesn't complete what it should.
    Could someone please help?
    Const strMailto = "[email protected]"
    Const strMailFrom = "[email protected]"
    Const strSMTPServer = "mrc1tpv002.XXXX.local"
    Const FileToRead = "\\Mrctpv005\WasteMan2G\Config\DCS\DCS_IN\alert.txt"
    arrTextToScanFor = Array("SVR2006","SVR2008")
    Set WshShell = WScript.CreateObject("WScript.Shell")
    Set objFSO = WScript.CreateObject("Scripting.FileSystemObject")
    Set oFile = objFSO.GetFile(FileToRead)
    dLastCreateDate = CDate(WshShell.RegRead("HKLM\Software\RDScripts\CheckTXTFile\CreateDate"))
    If oFile.DateCreated = dLastCreateDate Then
    intStartAtLine = CInt(WshShell.RegRead("HKLM\Software\RDScripts\CheckTXTFile\LastLineChecked"))
    Else
    intStartAtLine = 0
    End If
    i = 0
    Set objTextFile = oFile.OpenAsTextStream()
    Do While Not objTextFile.AtEndOfStream
    If i < intStartAtLine Then
    objTextFile.SkipLine
    Else
    strNextLine = objTextFile.Readline()
    For each strItem in arrTextToScanFor
    If InStr(LCase(strNextLine),LCase(strItem)) Then
    strResults = strNextLine & vbcrlf & strResults
    End If
    Next
    End If
    i = i + 1
    Loop
    objTextFile.close
    WshShell.RegWrite "HKLM\Software\RDScripts\CheckTXTFile\FileChecked", FileToRead, "REG_SZ"
    WshShell.RegWrite "HKLM\Software\RDScripts\CheckTXTFile\CreateDate", oFile.DateCreated, "REG_SZ"
    WshShell.RegWrite "HKLM\Software\RDScripts\CheckTXTFile\LastLineChecked", i, "REG_DWORD"
    WshShell.RegWrite "HKLM\Software\RDScripts\CheckTXTFile\LastScanned", Now, "REG_SZ"
    If strResults <> "" Then
    SendCDOMail strMailFrom,strMailto,"VPN Logfile scan alert",strResults,"","",strSMTPServer
    End If
    Function SendCDOMail( strFrom, strSendTo, strSubject, strMessage , strUser, strPassword, strSMTP )
    With CreateObject("CDO.Message")
    .Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
    .Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = strSMTP
    .Configuration.Fields.item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 'basic
    .Configuration.Fields.item("http://schemas.microsoft.com/cdo/configuration/sendusername") = strUser
    .Configuration.Fields.item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = strPassword
    .Configuration.Fields.Update
    .From = strFrom
    .To = strSendTo
    .Subject = strSubject
    .TextBody = strMessage
    On Error Resume Next
    .Send
    If Err.Number <> 0 Then
    WScript.Echo "SendMail Failed:" & Err.Description
    End If
    End With
    End Function

    Thankyou for that link, it did help quite a bit. What i wanted was to move it to csript so i could run the wscript.echo in commandline. It all took to long and found a way to complete it via Batch. I do have a problem with my script though and you might
    be able to help.
    What i am doing is searching the log file. Finding the specific words then outputting them to an email. I havent used bmail before so thats probably my problem but then im using bmail to send me the results.
    Then im clearing the log file so the next day it is empty so that when i search it every 15 minutes its clean and only when an error occurs it will email me.
    Could you help me send the output via email using bmail or blat?
    @echo off
    echo Wasteman Logfile checker
    echo Created by: Reece Vellios
    echo Date: 08/01/2014
    findstr "SRV2006 & SRV2008" \\Mrctpv005\WasteMan2G\Config\DCS\DCS_IN\Alert.Txt > c:\log4mail.txt
    if %errorlevel%==0 C:\Documents and Settings\rvellios\Desktop\DCS Checker\bmail.exe -s mrc1tpv002.xxx.local -t [email protected] -f [email protected] -h -a "Process Dump" -m c:\log4mail.txt -c
    for %%G in (\\Mrctpv005\WasteMan2G\Config\DCS\DCS_IN\Alert.Txt) do (copy /Y nul "%%G")
    This the working script without bmail
    @echo off
    echo Wasteman Logfile checker
    echo Created by: Reece Vellios
    echo Date: 08/01/2014
    findstr "SRV2006 & SRV2008" \\Mrctpv005\WasteMan2G\Config\DCS\DCS_IN\Alert.Txt > C:\log4mail.txt
    if %errorlevel%==0 (echo Connection error)
    for %%G in (\\Mrctpv005\WasteMan2G\Config\DCS\DCS_IN\Alert.Txt) do (copy /Y nul "%%G")
    I need to make this happen:
    If error occurs at "%errorlevel%=0" then it will output the c:\log4mail.txt via smtp email using bmail.

  • How to create a new Oracle OSB project automaticaly with script without IDE

    Hello,
    I want to create automatically an "Oracle service bus project" and an "Oracle service bus configuration project" with scripts (ANT or Maven or ...) without using IDE, without using workshop or Eclipse. I want to create automatically (ANT or Maven) just a skeleton of an OSB project witch i can use after in workshop.
    I want to create 1 "Oracle service bus configuration project" with many "Oracle service bus project" automatically (ANT or Maven or scripts) witch i can use after in workshop. How to create a new Oracle OSB project automaticaly with script without IDE ? How can i do this ?
    I'm using Oracle service bus 10.3.1
    Thank you for your help.

    Thank you for your response,
    I do not want to just create the services (proxy services and business services) but I want to create a template for 40 OSB project with the same scripts ANT/Maven.
    Template="Oracle service bus configuration project" + "Oracle service bus project" + services of 40 OSB projects
    The goal is that I have more than 40 projects to create and just the name of the projects that changes (when I say the name of the project ie the name of the OSB project, the name of proxy services and the name of business services ).
    So I want to give my script (ANT/Maven) the name of 40 OSB project and the script must generate the skeleton of the 40 projects at once time and after generation of skeleton of the 40 project, I will import them in the workshop to add manually mapping and routing and other things that differs from one project to another.
    So i want to generate automatically a skeletons of 40 OSB projects using a script (ANT / Maven) and I give to the script juste the names of the 40 projects.
    I want to create a "Oracle service bus configuration project" and "Oracle service bus project" automatically of 40 OSB projects (ANT or Maven or scripts) witch i can use after in workshop.
    I want to create one 'template' of all 40 projects in the same time, with the same directory structure (Transforlation, Business services, proxy services, WSDL .....) and all 40 project have the same transport, just the names of projects and services witch changes and i can give to the script all names of projects and services and i can give also all WSDL.
    Regards,
    Tarik

  • Split filename and create folders with Powershell script ( --newbie user)

    I have a folder with 1000's of files. Each file varies in length; typically between 9-14 characters. Example:
    C:\workpics\1238955678.1
    C:\workpics\744556224.1
    C:\workpics\744556224.2
    C:\workpics\8445655996.1
    I would like to run a script to split the filename and separate into folders. The filename would then consist of 5 characters, the foldername would be the first characters remaining.
    C:\workpics\12389\55678.1
    C:\workpics\7445\56224.1
    C:\workpics\7445\56224.2
    C:\workpics\84456\55996.1
    Any assistance to create this Powershell script would be awesome. Thank you!!

    I have a folder with 1000's of files. Each file varies in length; typically between 9-14 characters. Example:
    C:\workpics\1238955678.1
    C:\workpics\744556224.1
    C:\workpics\744556224.2
    C:\workpics\8445655996.1
    I would like to run a script to split the filename and separate into folders. The filename would then consist of 5 characters, the foldername would be the first characters remaining.
    C:\workpics\12389\55678.1
    C:\workpics\7445\56224.1
    C:\workpics\7445\56224.2
    C:\workpics\84456\55996.1
    Any assistance to create this Powershell script would be awesome. Thank you!!
    Please reread your request.  It makes no sense.  Read each statement carefully and notice that the statements are in conflict.
    Start your scrip in PowerShell.  Look up things like how to list files and how to manage strings.  All of the information you need is here:
    http://technet.microsoft.com/en-us/scriptcenter/dd793612.aspx
    ¯\_(ツ)_/¯

  • Re: How to create More two class with one object

    haii,
             i have small information How to create More two class with one object,
    bye
    bye
    babu

    Hello
    I assume you want to create multiple instance of your class.
    Assuming that you class is NOT a singleton then simply repeat the CREATE OBJECT statement as many times as you need.
    TYPES: begin of ty_s_class.
    TYPES: instance   TYPE REF TO zcl_myclass.
    TYPES: end of ty_s_class.
    DATA:
      lt_itab      TYPE STANDARD TABLE OF ty_s_class
                     WITH DEFAULT KEY,
      ls_record  TYPE ty_s_class.
      DO 10 TIMES.
        CLEAR: ls_record-instance.
        CREATE OBJECT ls_record-instance.
        APPEND ls_record TO lt_itab.
      ENDDO.
    Regards
      Uwe

  • Creating User Table, User Field ... with Script SQL in C#

    Hi every body,
    I wonder if we could create a user table, user field ... with script SQL in C#.
    Should I use the reference Microsoft.SqlServer.ScriptTask ??
    Thank you for your Help

    Haifa,
    I am not sure where your question is directed.  The forum that you have posted your question in is for questions related to the SAP Business One SDK.  Are you looking to create new user tables/fields in SAP Business One?  If so you can do this either through the SAP Business One SDK interface using Tools > User Defined Fields and/or Tools > User Defined tables.
    You can also create metadata objects in Business One programatically using the UserTablesMD and/or UserFields objects.
    SAP does not support direct SQL writes to the SAP Business One Db.
    HTH,
    Eddy

  • Failed to create recognisable class with token

    anyone know what this error message means?
    "Failed to create recognisable class with token <num>"
    I'm running a JNI app.

    Probably something that comes from the code of the application itself.

  • LSMW - create equipment with class/characterisctic assign

    Dear all,
    I'm create LSMW with below setup. I would like to create an equipment with class and characteristic assign to it.
    There will be 3 upload file to be used. How I can do a linking between Equipment data with Classifcation/characteristic data? Some equipment in upload file may not contain class.
    Object: 0400 (Equipment)
    Method: 0001 (Create BI)
    Program name : IBIP
    Data Source structure
    IBIPEQUI (Equipment )
             |_ IBIPCLASS (Classification)
                      |_ IBIPFEAT (Characteristics)

    Hi,
    I'm using standard batch program. I managed to create equipment. However, I'm not able to assign/link each class/char to each equipment stated in equipment upload file.
    Object: 0400
    Method: 0001
    Program name: IBIP

  • Script to Create databases with params to support dir location for data or log files

    Script to Create databases with params to support dir location for data or log files

    DECLARE @Query VARCHAR(MAX)=''
    DECLARE @DbName VARCHAR(400) = '<DBNAME>'
    DECLARE @DbFilePath VARCHAR(400) = '<Valid DataFilePath>'
    DECLARE @DBLogFilePath VARCHAR(400)='<Valid LogFile Path>'
    SET @Query = @Query + 'CREATE DATABASE '+@DbName +' ON PRIMARY '
    SET @Query = @Query + '( NAME = '''+@DbName +''', FILENAME = '''+@DbFilePath+@DbName +'.mdf'' , SIZE = 3072KB , MAXSIZE = UNLIMITED, FILEGROWTH = 1024KB ) '
    SET @Query = @Query + ' LOG ON '
    SET @Query = @Query + '( NAME = '''+@DbName +'_log'', FILENAME = '''+@DblogFilePath+@DbName +'_log.ldf'' , SIZE = 1024KB , MAXSIZE = 2048GB , FILEGROWTH = 10%)'
    print @query
    exec(@query)
    --Prashanth

  • Having problems in creating a class with name File.

    I want to compile a new class with class name as File, i have made it part of a new package also but still i am getting this error
    "File.java:2: CustomFile.File is already defined in this compilation unit
    import java.io.File;
    ^
    File.java:6: cannot resolve symbol
    symbol : constructor File ()
    location: class java.io.File
    inFile = new java.io.File();
    ^
    2 errors"
    Here is the source code of the file:
    package CustomFile;
    import java.io.File;
    public class File {
    private java.io.File inFile;
    public File(){
         inFile = new java.io.File();
         System.out.println("hi file");
    }

    Any help is appreciated.
    I want to compile a new class with class name as File,
    i have made it part of a new package also but still i
    am getting this error
    "File.java:2: CustomFile.File is already defined in
    this compilation unit
    import java.io.File;
    ^
    File.java:6: cannot resolve symbol
    symbol : constructor File ()
    location: class java.io.File
    inFile = new java.io.File();
    ^
    2 errors"
    Here is the source code of the file:
    package CustomFile;
    import java.io.File;
    public class File {
    private java.io.File inFile;
    public File(){
         inFile = new java.io.File();
         System.out.println("hi file");

  • How to create test classes with JUnit?

    Hello,
    I need to test my classes with JUnit. My editor is BlueJ.
    This is my class:
    package model;
    import java.util.*;
    public class Category
        private String name;
        private List<Appointment> appointments;
        private List<ToDo> toDos;
        public Category(String name)
            this.name = name;
            appointments = new ArrayList<Appointment>();
            toDos = new ArrayList<ToDo>();
        public String getName()
            return this.name;
        public void setName(String newName)
            this.name = newName;
        public void addAppointment(Appointment a)
            appointments.add(a);
        public void removeAppointment(Appointment a)
            appointments.remove(a);
        public void addToDo(ToDo t)
            toDos.add(t);
        public void removeToDo(ToDo t)
            toDos.remove(t);
        public List<Appointment> getAppointments()
            return appointments;
        public List<ToDo> getToDos()
            return toDos;
    }This is my JUnit test class code so far:
    package model;
    import java.util.*;
    * The test class CategoryTest.
    * @author  (your name)
    * @version (a version number or a date)
    public class CategoryTest extends junit.framework.TestCase
       private Category cat;
        protected void setUp()
            cat = new Category("Kategori");
        public void testGetAndSetName()
            assertTrue(cat.getName().equals("Kategori"));
            cat.setName("Kategori 2");
            assertTrue(cat.getName().equals("Kategori 2"));
            assertFalse(cat.getName().equals("Kategori"));
    }Any hint would be appreicted.
    Best regards,
    Turtle

    jonasse wrote:
    Hehe:)
    This is my code:
       private Category cate;
    protected void setUp() {
    text = new Appointment("Aftale",TimeStampGenerator.generate(1, 1, 2009), TimeStampGenerator.generate(1, 2, 2009));
    cate = new Category("Aftaler");
    public void testSetAndGetText() {
    assertTrue(text.getText().equals("Aftale"));
    text.setText("Andre aftaler");
    assertTrue(text.getText().equals("Andre aftaler"));
    public void testSetAndGetCategory()
    assertTrue(text.getText().equals("Aftale"));
    text.setText("Andre Aftaler");
    assertFalse(text.getText().equals("Aftale"));
         public void testGetAndSetStartTime() {
             assertTrue(text.getStartTime().equals(TimeStampGenerator.generate(1,2,2009)));
             text.setStartTime(TimeStampGenerator.generate(1,2,2008));
             assertTrue(text.getStartTime().equals(TimeStampGenerator.generate(1,2,2008)));
             assertFalse(text.getStartTime().equals(TimeStampGenerator.generate(1,2,2009)));
    }The last method compiles, but I get a failure when I run the test. Says no exception message???
    Thanks in advance,
    JonasSo this is where TDD kicks in. Your mission - should you choose to become test-infected - is to write tests that fail, preferably even don't compile, and then write the code that makes them pass. Compilation is no guarantee the thing will work. In all honesty, that test is probably too busy. Ideally, each test case has exactly one assert in it. That way, you can know instantly what's gone wrong. If you reply "but my code can't be tested like that" it's probably time to refactor it so that it can

Maybe you are looking for

  • Orange BT Openzone Problem

    Has anyone successfully managed to connect to BT Openzone from an Orange iPhone since New Year? Neil

  • E)2581279      Assert failed in /modules/streams/flv/TCFLVData.cpp line 1202

    In an application where I do a recording from webcam to fms, sometimes I obtain this error in core.XX.log: (e)2581279 Assert failed in /modules/streams/flv/TCFLVData.cpp line 1202 - when it happens the effect client side is that I try to play a strea

  • Converting AIR-LAP1131G-A-K9 to LWAPP

    I noticed that this AP was $350 as compared to the AIR-LAP1131AG-A-K9 which is $450. The latter comes with an A radio which I don't need. But it comes shipped LWAPP which is good. Can I convert the cheaper one to LWAPP? The models are: http://www.cdw

  • Mac:Office Icons

    Personally I have never liked the Office for Mac icons. I'm lucky enough to be a beta tester for Office 2008 and well, they still haven't changed the icons. Its been 8 years already! Anyway, I was whining to buddy about it and he found me a download

  • Can anyone make this classical report? it's challenge

    Date...                                                                            Sr. No     Item Descrption     Quantity     UOM     Vendor-1                              Vendor-2                                              Contact Per.