JUnit Help Please.

/**     * This method compares the supplied Date object with the current date,
     * returns true if the year month and day of the supplied Date are
     * are equal the year, month and day of the current date, time is ignored.
     * @param java.util.Date date
     * @return boolean
     public static boolean isToday(Date date) {
          //Get Current Date
          Calendar rightNow = Calendar.getInstance();
          int todayDay = rightNow.get(Calendar.DAY_OF_MONTH);
          int todayMonth = rightNow.get(Calendar.MONTH);
          int todayYear = rightNow.get(Calendar.YEAR);
          GregorianCalendar passedDate = new GregorianCalendar();
          passedDate.setTime(date);
          if (todayYear == passedDate.get(Calendar.YEAR)
               && todayMonth == passedDate.get(Calendar.MONTH)
               && todayDay == passedDate.get(Calendar.DAY_OF_MONTH))
               return true;
          else
               return false;
     public void testIsToday() {
               String valid = "03-March-2004";
               String formatted = CommonUtils.isToday(valid);
               assertTrue("Valid input did not return formatted value correctly", !valid.equals(formatted));
               System.out.println("Formatted Today = " + formatted);
Can Someone please tell me what i am doing wrong in JUnit?? Thanks;

What happens? This isn't even a complete class.
Do you get a compile or runtime error? What does it
say?
I don't know about JUnit, but your manner for asking
questions is pretty poor. - MODIn defense of the OP - there's enough there for those familiar with JUnit. The first method is coming from the tested class, while the second method resides in a subclass of TestCase, I assume...

Similar Messages

  • Little help please with forwarding traffic to proxy server!

    hi all, little help please with this error message
    i got this when i ran my code and requested only the home page of the google at my client side !!
    GET / HTTP/1.1
    Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, application/x-shockwave-flash, */*
    Accept-Language: en-us
    UA-CPU: x86
    Accept-Encoding: gzip, deflate
    User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; InfoPath.2; .NET CLR 2.0.50727)
    Host: www.google.com
    Connection: Keep-Alive
    Cookie: PREF=ID=a21457942a93fc67:TB=2:TM=1212883502:LM=1213187620:GM=1:S=H1BYeDQt9622ONKF
    HTTP/1.0 200 OK
    Cache-Control: private, max-age=0
    Date: Fri, 20 Jun 2008 22:43:15 GMT
    Expires: -1
    Content-Type: text/html; charset=UTF-8
    Content-Encoding: gzip
    Server: gws
    Content-Length: 2649
    X-Cache: MISS from linux-e6p8
    X-Cache-Lookup: MISS from linux-e6p8:3128
    Via: 1.0
    Connection: keep-alive
    GET /8SE/11?MI=32d919696b43409cb90ec369fe7aab75&LV=3.1.0.146&AG=T14050&IS=0000&TE=1&TV=tmen-us%7Cts20080620224324%7Crf0%7Csq38%7Cwi133526%7Ceuhttp%3A%2F%2Fwww.google.com%2F HTTP/1.1
    User-Agent: MSN_SL/3.1 Microsoft-Windows/5.1
    Host: g.ceipmsn.com
    HTTP/1.0 403 Forbidden
    Server: squid/2.6.STABLE5
    Date: Sat, 21 Jun 2008 01:46:26 GMT
    Content-Type: text/html
    Content-Length: 1066
    Expires: Sat, 21 Jun 2008 01:46:26 GMT
    X-Squid-Error: ERR_ACCESS_DENIED 0
    X-Cache: MISS from linux-e6p8
    X-Cache-Lookup: NONE from linux-e6p8:3128
    Via: 1.0
    Connection: close
    java.net.SocketException: Broken pipe // this is the error message
    at java.net.SocketOutputStream.socketWrite0(Native Method)
    at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
    at java.net.SocketOutputStream.write(SocketOutputStream.java:115)
    at java.io.DataOutputStream.writeBytes(DataOutputStream.java:259)
    at SimpleHttpHandler.run(Test77.java:61)
    at java.lang.Thread.run(Thread.java:595)
    at Test77.main(Test77.java:13)

    please could just tell me what is wrong with my code ! this is the last idea in my G.p and am havin difficulties with that cuz this is the first time dealin with java :( the purpose of my code to forward the http traffic from client to Squid server ( proxy server ) then forward the response from squid server to the clients !
    thanx a lot,
    this is my code :
    import java.io.*;
    import java.net.*;
    public class Test7 {
    public static void main(String[] args) {
    try {
    ServerSocket serverSocket = new ServerSocket(1416);
    while(true){
    System.out.println("Waiting for request");
    Socket socket = serverSocket.accept();
    new Thread(new SimpleHttpHandler(socket)).run();
    socket.close();
    catch (Exception e) {
    e.printStackTrace();
    class SimpleHttpHandler implements Runnable{
    private final static String CLRF = "\r\n";
    private Socket client;
    private DataOutputStream writer;
    private DataOutputStream writer2;
    private BufferedReader reader;
    private BufferedReader reader2;
    public SimpleHttpHandler(Socket client){
    this.client = client;
    public void run(){
    try{
    this.reader = new BufferedReader(
    new InputStreamReader(
    this.client.getInputStream()
    InetAddress ipp=InetAddress.getByName("192.168.6.29"); \\ my squid server
    System.out.println(ipp);
    StringBuffer buffer = new StringBuffer();
    Socket ss=new Socket(ipp,3128);
    this.writer= new DataOutputStream(ss.getOutputStream());
    writer.writeBytes(this.read());
    this.reader2 = new BufferedReader(
    new InputStreamReader(
    ss.getInputStream()
    this.writer2= new DataOutputStream(this.client.getOutputStream());
    writer2.writeBytes(this.read2());
    this.writer2.close();
    this.writer.close();
    this.reader.close();
    this.reader2.close();
    this.client.close();
    catch(Exception e){
    e.printStackTrace();
    private String read() throws IOException{
    String in = "";
    StringBuffer buffer = new StringBuffer();
    while(!(in = this.reader.readLine()).trim().equals("")){
    buffer.append(in + "\n");
    buffer.append(in + "\n");
    System.out.println(buffer.toString());
    return buffer.toString();
    private String read2() throws IOException{
    String in = "";
    StringBuffer buffer = new StringBuffer();
    while(!(in = this.reader2.readLine()).trim().equals("")){
    buffer.append(in + "\n");
    System.out.println(buffer.toString());
    return buffer.toString();
    Edited by: Tareq85 on Jun 20, 2008 5:22 PM

  • Blast speed is currently 2 Mbps/9 Mbps on the Comcast Speed Test. Help please!

    I've had the Blast service for quite some time, and have noticed painfully slow internet browsing for the last couple of months. I mean...pull-my-hair-out-slow.  I just did a Comcast speed test and the results were 2.31 Mpbs and 9.01 Mpbs. Um....that would explain things. But not really... as I'd love to see the speeds I'm supposed to have. Even double digits would be nice! I'm trying to run ShaperProbe but I get the error "Servers are busy. Try again later." I've tried a few times. I'll post the results if I can get the scan to work. Power level is 45-46 dBmV and SNR 35-37 Modem: ARRIS Motorola SurfBoard SB6141 DOCSIS 3.0Logs of June 2015 (the most recent, and the logs before that are January): Jun 22 2015 07:07:243-CriticalT05.0SYNC Timing Synchronization failure - Loss of Sync;CM-MAC=b8:16:19:fa:b8:0c;CMTS-MAC=00:1d:70:af:fd:a0;CM-QOS=1.1;CM-VER=3.0;Jun 18 2015 08:04:503-CriticalR02.0No Ranging Response received - T3 time-out;CM-MAC=b8:16:19:fa:b8:0c;CMTS-MAC=00:1d:70:af:fd:a0;CM-QOS=1.1;CM-VER=3.0;Jun 18 2015 07:08:273-CriticalT05.0SYNC Timing Synchronization failure - Loss of Sync;CM-MAC=b8:16:19:fa:b8:0c;CMTS-MAC=00:1d:70:af:fd:a0;CM-QOS=1.1;CM-VER=3.0;Jun 17 2015 23:08:553-CriticalR02.0No Ranging Response received - T3 time-out;CM-MAC=b8:16:19:fa:b8:0c;CMTS-MAC=00:1d:70:af:fd:a0;CM-QOS=1.1;CM-VER=3.0;Jun 16 2015 02:43:065-WarningZ00.0MIMO Event MIMO: Stored MIMO=-1 post cfg file MIMO=-1;CM-MAC=b8:16:19:fa:b8:0c;CMTS-MAC=00:1d:70:af:fd:a0;CM-QOS=1.1;CM-VER=3.0; I would sure appreciate any ideas. I have not contacted tech support yet, although that may be faster??  We'll see.  Thanks in advance for any help!  

    ShaperProbe has not been usable for some time, unfortunately. Check to see if Comcast is reporting an outage for your area by logging in to https://customer.xfinity.com/Secure/MyServices/ or by checking the voice response system at 1-800-Comcast.
    If no outage is reported, see Connection Troubleshooting Tips. If you want to troubleshoot this yourself and still need help, please provide Information Requested for Connection-Related Posts.
    If you are using Wifi it's best to switch to an Ethernet connection if possible while measuring speed and checking the reliability of your connection to Comcast.
    If you'd rather have them do the troubleshooting call them at the phone number on your bill or 1-800-Comcast and have them send a tech out to identify the cause and correct it.
    If the tech finds bad coax, splitters, amplifiers, or connections in your home (even if Comcast originally supplied them) you'll probably have to pay for the visit unless you have their Service Protection Plan (http://www.xfinity.com/spp/, about $5/mo). If the trouble is due to a faulty Comcast modem, eMTA, gateway device, or anything outside your home, you shouldn't be charged.

  • Empty iphoto library, albums still there, photos in Finder, help please

    The last time I opened iPhoto with my library present, I got a message saying that this version of iPhoto could rebuild my thumbnails with better detail and did I want to rebuild now. I said yes, as they hadn't been rebuilt in a while. There were three files created after that ThumbJPGSegment.data, Thumb32Segment.data and Thumb64Segment.data. When I open iPhoto, it says "no photos" at the bottom and the screen is blank and gray. On the left only some of my albums are listed as they were, and all contain (0) photos. I do have all the pictures still there in Finder. I read the exchange from 10/31 with Terence and it would seem I have a corrupt file that needs to be copied or restored. I have a back-up of the library, but it exists in three parts. The first two were created using the backup facility back in June. Then I backed up, again with the utility, just the pictures between the last back-up and the end of our trip in July. We just completed a 10-month trip around the world and I have about 19G and 5,400 pix to restore and would like to keep them in the original albums, esp. since many have been photocasted and the links are all placed in a Photo Archive page on our website. Terence said to copy the library6.photo file from the backup to the hard drive, but can I do this in three parts? If I use the backup utility's restore command will that do it for me, considering the fact that the complete library is a combination of two different back-ups? Help please! Thx!

    Folks
    Try these in order - from best option on down...
    1. Do you have an up-to-date back up? If so, try copy the library6.iphoto file from the back up to the iPhoto Library allowing it to overwrite the damaged file.
    2. Download iPhoto Library Manager and use its rebuild function. This will create a new library based on data in the albumdata.xml file. Not everything will be brought over - no slideshows, books or calendars, for instance - but it should get all your albums back.
    3. If neither of these work then you'll need to create and populate a new library.
    To create and populate a new library:
    Note this will give you a working library with the same Events and pictures as before, however, you will lose your albums, keywords, modified versions, books, calendars etc.
    Move the iPhoto Library to the desktop
    Launch iPhoto. It will ask if you wish to create a new Library. Say Yes.
    Go into the iPhoto Library on your desktop and find the Originals folder. From the Originals folder drag the individual Event Folders to the iPhoto Window and it will recreate them in the new library.
    When you're sure all is well you can delete the iPhoto Library on your desktop.
    In the future, in addition to your usual back up routine, you might like to make a copy of the library6.iPhoto file whenever you have made changes to the library as protection against database corruption.

  • I cannot install the latest version of itunes as I have old versions of bonjour and quicktime. I can't remove these programs either. Help please as I have tried almost everything I have found so far on the the web.

    I cannot install the latest version of itunes as I have old versions of bonjour and quicktime. I can't remove these programs either. Help please as I have tried almost everything I have found so far on the the web.

    Unfortunately, this sort of trouble has gotten more complicated to deal with ever since Microsoft pulled the Windows Installer CleanUp utility from their Download Center on June 25. First we have to find a copy of the utility.
    Let's try Googling. (Best not to use Bing, I think.) Look for a working download site for at least version 3.0 of the Windows Installer CleanUp utility. (The results from mydigitallife and Major Geeks are worth checking.)
    After downloading the utility installer file (msicuu2.exe), scan the file for malware, just in case. (I use the free version of Malwarebytes AntiMalware to do single-file scans for that.)
    If the file is clean, to install the utility, doubleclick the msicuu2.exe file you've downloaded.
    Now run the utility ("Start > All Programs > Windows Install Clean Up"). In the list of programs that appears in CleanUp, select any Bonjour and QuickTime entries and click "Remove".
    Quit out of CleanUp. Restart the PC, and try another iTunes install. Does it go through properly this time?

  • TS4058 HELLO I WOULD LIKE TO CREATE AN IWEB but I cannot create a .mac account help please?

    Hello,
    I am having trouble trying with publishing my iWeb site however I am taking to log in screen for the .mac account and cannot log into it. I am not sure if I have one created. I created one through iChat I believe but it is still giving me an invalid account name or password after submitting the website to be published. Can anyone help please? I am currently using a Macbook 2008 series with Leopard 10.5 OS... thank you, Sahara

    iChat and MobileMe are NOT the same thing.  .Mac does not exist and has not now for several years - it is MobileMe instead, but unless you already have an account which is sounds as if you don't, then it is too late. You can't get one now.
    If you want to publish your site, then you'll have to find a domain name registrar and register a domain name of choice and then purcahse hosting too and then you can publish by publishing to a local folder and then uploading using an ftp client such as Cyberduck.
    Start by taking a look at http://www.godaddy.com or http://www.hostexcellence.com where you can register a domain name and purchase hosting.
    MobileMe will no longer exist as of 30th June this year - it is going and iCloud has taken over, but will not host websites so everyone on this forum is having to search for alternative hosting.
    Perhaps do a search of this forum for the relevant topics.

  • Help please with n81 8gb

    i have a nokia n81 8gb and tryed putting free unlocking codes in myself i been told if you put them in more than 2 times you cant put them in anymore is this true ???
    is there anyway round it eg. like taking the battary out and leaving it for a couple of days ????
    please can anybody help
    please email on thanks
    *moderator note: e-mail address removed for security reasons*
    Message Edited by spanishtaco on 10-Jun-2008 10:36 AM

    I think the OP means the network unlocking code so that the phone can be used on networks other than the one that provided it in the first place.
    I do believe that it is indeed the case that 3 failed attempts to enter the code does result in the phone being locked, meaning a trip to a Nokia care point to have it re-flashed, but don't quote me on that. I'm not 100% sure.
    Was this post helpful? If so, please click on the white "Kudos!" star below. Thank you!

  • I keep being asked to update my Safari but when I do a Software update it scans but never gives me a list and just says no new updates. Help please!

    I keep being asked to update my Safari but when I do a Software update it scans but never gives me a list and just says no new updates. Help please!

    There are no updates to either OS 10.5.8 or Safari 5.0.6.
    If you need a later version of Safari you must first upgrade your operating system to a later version of OS X.

  • At the end of my IMovie I want to write some text: as in" Happy Birthday Mandy we had a great time with you. etc..  How do I go about this? Which icon in IMovie lets me have a place to write text?? help please

    Please see my ? above: Im making an IMovie and need the last frame to just be text (can be on a color). I don't know how to go about doing this.  Ive already done all my photos and captions. Need to have it ready for TOMORROW: Friday May 23rd. Help please!
    Thanks

    You can choose a background for the text from Maps and Backgrounds.  Just drag a background to the end of the timeline, adjust to desired duration then drag title above it.
    Geoff.

  • I have just updated my PC with version11.14. I can no longer connect to my Bose 30 soundtouch via media player Can anyone help please

    I have a Bose soundtouch system .Until today I could play my iTunes music through it via air  player . .I have just uploaded the latest upgrade from iTunes and now I am unable to connect to the Bose system . Can anyone help please? I can connect via my iPad and by using the Bose app so it is not the Bose at fault

    @puebloryan, I realize this thread is a bit old, but I have encountered a similr problem and wondered if you had found a solution. I've been using home sharing from itines on my PCs for years, but two days ago, it suddenly stopped. I can share from my Macs, but not from the ONE PC library where I keep all my tunes. I tried all the usual trouble-shooting measures.
    After turning home sharing off on the PC's iTunes, turning it back on and turning some other settings off and on, my Macs and Apple TV could briefly "see" the PC library, but as soon as I try to connect -- the wheel spins for a bit and then the connection vanishes. It's as if they try and then give up.
    Since this sounds so similar to your problem, I was hoping you finally found a solution. I am also starting a new thread. Thanks!

  • My iMac 24 can no longer be paired with the keyboard; it doesn't recognise any keyboard at boot up, even the one it is paired with. Can anyone help, please?

    My iMac 24 can no longer be paired with the keyboard; it doesn't recognise any keyboard at boot up, even the one it is paired with. Can anyone help, please?
    Thank. Simon

    Brian - The batteries are fine and there has only every been one keyboard paired with it. We have tried my MacPro keyboard as well, and it will not even recognise that there is a discoverable keyboard nearby.
    Thanks, Simon

  • Photoshop Elements 6 on Mac help please !!!!!

    Hi there,
              I need help please !!!!!
    I have PSE 6 for my imac and bought myself a NIKON D60 so far so good. I have installed PSE 6 which comes with ADOBE Bridge CS3
    I have bought a book as well as I am new to photoshop and in fact DSLR cameras.
    I have got my photos into Bridge OK by the way they are JPEG format. According to the book I can open the JPEG in camera RAW by either selecting the JPEG and then pressing cmd+R or by selecting the JPEG and select open with and camera RAW should be available to selct.
    I cannot get of the options to work any ideas please
    Secondly I have taken some photos in RAW format and put then into Bridge again I cannot get the camera RAW interface to open with these neff images.
    If I try to open the image PSE 6 opens and gives me an error that the file format is not supported by PSE 6
    Am I missing something here as I have been trying for a week now !!!!!
    Sorry if this comes across a stupid question but it is new to me
    Chris      UK

    There's no "theory" about it. You should be able to open a raw file from bridge by double-clicking it, but it will open in ACR in PSE. You can't just use ACR within bridge in PSE, if that's what you're trying to do. To open a JPEG in ACR, go to file>Open in PSE and choose Camera raw as the format after you select the file but before you click Open.
    If you've correctly updated ACR, bridge should show you thumbnails of your raw files. If it doesn't try emptying the Bridge cache.

  • Photoshop CS2. Help please.

    Approx 8 years ago I purchased Photoshop CS2 online from Adobe. This past weekend I had to buy a new computer (Windows 8.1), and when I logged into my Adobe account just now to obtain my serial number and enter it after I attempted to download CS2, it said invalid serial number. Help please.
    Both tech support and the online chat person were not able to help me.

    The Activation Servers for CS2 and prior have been taken down. See the link below for an explanation and solution. Be sure to follow all directions, including using the new download serial number supplied on the page.
    CS2 and prior
    http://helpx.adobe.com/x-productkb/policy-pricing/creative-suite-2-activation-end-life.htm l
    --OB

  • I  used to have an OLD Photoshop cd but it has been lost and my program is no longer on cd. I talked with some photographer friends and this is what one of them told me to get: Adobe Photoshop Lightroom and CS CC... HELP please?

    I  used to have an OLD Photoshop cd but it has been lost and my program is no longer on cd. I talked with some photographer friends and this is what one of them told me to get: Adobe Photoshop Lightroom and CS CC... HELP please?

    If you still have your serial number, look at OLDER previous versions http://www.adobe.com/downloads/other-downloads.html
    Otherwise, the US$ 9.99 plan is what is current at Cloud Plans https://creative.adobe.com/plans

  • Creative live cam voice help please

    Help please,
    We are using the "live cam voice" model, with our computer (Vista 32bit), that appears to work OK, but after a few minutes we get the BSOD! We have tried un installing and re-installing drivers without any effect.Has anyone had this problem and if so how did you fix it.
    Regards,
    Arthur

    Thanks for your response. I have tried 3 ports so far, all with the same outcome. One of my sons had it happen to him on another computer (XP SP2) using this webcam . As to programmes open at the same time, I am not computer literate and have no idea what programmes were running on each occasion.We use the webcam for Skype and apart from that I may also have IE open and perhaps Outlook Express. Over and above those CS4 sometimes.
    If I cannot resolve this, can any one suggest another webcam please.
    Regards,
    Arthur

Maybe you are looking for

  • How to find classes in ABAP

    Hi experts,     In java it is easy to find related classes for our requirement based on package and related methods by using API.But how to find that these are the classes are existing for this particular requirement in ABAP.In se24 we can find exist

  • How do you change a microsoft word file back from pdf file?

    I had a document I created and switched to pdf file. How do I change it back?

  • How do I connect two lines together.

    I have two lines at an angle but where the corner of the angle is supposed to be there is a little triangle missing. I tried joining the two lines together but when I hit join one line goes past the other. Before Joining: After Joining:

  • Problem with using View Generator Plug-in in AWM

    Hi, I have noticed that the View Generator Plug-in does not show me the Level Short Desc and Level Long Desc when I pick the fields to be written to the view. Has anybody encountered this before? I am using Oracle 10gR2 Thanks, Bharat

  • How to register a non-local database

    Hi All, I am fairly new to ms sql server 2008, which has been installed to my workstation. I have been trying to add a database which is in a ms sql server 2000 that resides in a another machine My purpose is to run queries from my workstation. I hav