Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Methode setYear wird nicht verwendet

Empfohlene Antworten

Veröffentlicht

Hi,

ich habe gerade neu mit java angefangen und habe folgendes Problem:

import junit.framework.*;

import java.util.*;

import com.ikea.framework.error.*;

import com.ikea.framework.connector.ebb.*;

import com.ikea.ebccbd1.client.bs.*;

import com.ikea.ebccbd1.client.vo.*;


/**

 * Test case class for the BsGetCompByCompFunc

 * The purpose of this test case is to find company with details

 * when the given input data is one of the following:

 * Mandatory: ValidAt, CF (Class, Type, Code)

 * @author: MLRI

 * @version 1.0 

 * @since 1-0.5

 */

public class BsGetCompByCompFuncTest extends BsBaseTestCase {


static class TestData {


		String vCompType;             // expected company type

 		int vErrorCode;               // expected error code


    // local input VoCompGet


    String vCUTClass;

    String vCUTType;

    String vCompFuncCode;

    Date vValidAt;

    VoCompGet vVoCompGet = new VoCompGet();


		// constructor for TestData

  	public TestData(int pValidAtYear,

	  	              int pValidAtMonth,

	  	              int pValidAtDay,

   									String pCUTClass,

    								String pCUTType,

    								String pCompFuncCode,

	  	              String pCompType,

	  	              int pErrorCode) {



		  if (pValidAtYear > 0) {

			 [COLOR=red] this.vValidAt.setYear(pValidAtYear);

			  this.vValidAt.setMonth(pValidAtMonth);

			  this.vValidAt.setDate(pValidAtDay);			   [/COLOR] 

				this.vVoCompGet.setValidAt(vValidAt);

				}

		  if (pCUTClass.length() > 0) {

				this.vVoCompGet.setCUTClass(pCUTClass);

		  }

		  if (pCUTType.length() > 0) {

				this.vVoCompGet.setCUTType(pCUTType);

		  }		  

		  if (pCompFuncCode.length() > 0) {

		  	this.vVoCompGet.setCompFuncCode(pCompFuncCode);

		  }

		  this.vCompType = pCompType;

		  this.vErrorCode = pErrorCode;


  		}

	}

}

VoCompGet ist eine eigene Klasse, die unter anderen das Attribut ValidAt als Date hat. Als testdata bekomme ich jahr, Monat und Tag als int und will dann ValidAt zusammensetzen (roter Bereich). Leider bekomme ich dann die Warnungen:

Die für den Typ java.util.Date mit Argumenten (int) aufgerufene Methode setYear wird nicht verwendet

Die für den Typ java.util.Date mit Argumenten (int) aufgerufene Methode setMonth wird nicht verwendet

Die für den Typ java.util.Date mit Argumenten (int) aufgerufene Methode setDate wird nicht verwendet

Ich habe leider nur keine Ahnung warum, weiß jemand Rat ??

Die Klasse Date repräsentiert einen Zeitpunkt.

Datumsmanipulationen sollte man über die Klasse Calendar oder GregorianCalendar durchführen.

Beispiel:

Calendar.set(Calendar.MONTH, int month);

Kannst du aber auch in den API Docs des JDK nachlesen.

Gruß Jaraz

AHA, Ich fühle mich erleuchtet.

Vielen Dank :D Läuft jetzt.

Wer kommt auf so eine Idee, das Datums-Objekt nicht Date zu nennen, sondern Calendar ...

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.