Package org.apache.kato.tck.scenario142.javaruntime

Source Code of org.apache.kato.tck.scenario142.javaruntime.TestJavaField_getInt

/*******************************************************************************
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package org.apache.kato.tck.scenario142.javaruntime;

import javax.tools.diagnostics.runtime.java.JavaField;
import javax.tools.diagnostics.runtime.java.JavaObject;

import org.apache.kato.tck.harness.TCKJavaRuntimeTestcase;
import org.apache.kato.tck.scenario142.javaruntime.SetupJavaField_getInt;


/**
* Test JavaField.getInteger() against various fields and values.
*
*/
public class TestJavaField_getInt extends TCKJavaRuntimeTestcase {
 
  SetupJavaField_getInt setup=new SetupJavaField_getInt();
 
  static JavaObject thisObject = null
  public JavaObject getScenerioReference() {
    if (thisObject == null) {
      thisObject = super.getScenerioReference();
   
    return thisObject;   
  }
 
  public void testMaxIntegerValue() throws Exception {
    JavaObject thisJavaObject = getScenerioReference();
    JavaField maxIntegerField = getJavaField(thisJavaObject, "maxInteger");
   
    int maxIntegerValue = maxIntegerField.getInt(thisJavaObject);
   
    assertEquals(setup.maxInteger, maxIntegerValue);   
  }
 
  public void testMinIntegerValue() throws Exception {
    JavaObject thisJavaObject = getScenerioReference();
    JavaField minIntegerField = getJavaField(thisJavaObject, "minInteger");
   
    int minIntegerValue = minIntegerField.getInt(thisJavaObject);
   
    assertEquals(setup.minInteger, minIntegerValue);   
  }

  public void testStaticMinIntegerValue() throws Exception {
    JavaObject thisJavaObject = getScenerioReference();
    JavaField minIntegerField = getJavaField(thisJavaObject, "staticMinInteger");
   
    int minIntegerValue = minIntegerField.getInt(null);
   
    assertEquals(SetupJavaField_getInt.staticMinInteger, minIntegerValue);   
  }
 
  public void testZeroIntegerValue() throws Exception {
    JavaObject thisJavaObject = getScenerioReference();
    JavaField zeroIntegerField = getJavaField(thisJavaObject, "zeroInteger");
   
    int zeroIntegerValue = zeroIntegerField.getInt(thisJavaObject);
   
    assertEquals(setup.zeroInteger, zeroIntegerValue);   
  }
 
  public void testNegIntegerValue() throws Exception {
    JavaObject thisJavaObject = getScenerioReference();
    JavaField negIntegerField = getJavaField(thisJavaObject, "negInteger");
   
    int negIntegerValue = negIntegerField.getInt(thisJavaObject);
   
    assertEquals(setup.negInteger, negIntegerValue);   
 
 
  public void testPosIntegerValue() throws Exception {
    JavaObject thisJavaObject = getScenerioReference();
    JavaField posIntegerField = getJavaField(thisJavaObject, "posInteger");
   
    int posIntegerValue = posIntegerField.getInt(thisJavaObject);
   
    assertEquals(setup.posInteger, posIntegerValue);   
  }


  public void testDoubleValue() throws Exception {
    JavaObject thisJavaObject = getScenerioReference();
    JavaField doubleValueField = getJavaField(thisJavaObject, "doubleValue");

    try{
      int aDoubleValue = doubleValueField.getInt(thisJavaObject);
      fail("Missing illegal argument exception from JavaField.getInt(doubleValue)");
    } catch (IllegalArgumentException e) {
      // expected
   
  }
 
  public void testFloatValue() throws Exception {
    JavaObject thisJavaObject = getScenerioReference();
    JavaField floatValueField = getJavaField(thisJavaObject, "floatValue");

    try{
      int aFloatValue = floatValueField.getInt(thisJavaObject);
      fail("Missing illegal argument exception from JavaField.getInt(floatValue)");
    } catch (IllegalArgumentException e) {
      // expected
   
  }
 
  public void testLongValue() throws Exception {
    JavaObject thisJavaObject = getScenerioReference();
    JavaField longValueField = getJavaField(thisJavaObject, "longValue");

    try{
      int aLongValue = longValueField.getInt(thisJavaObject);
      fail("Missing illegal argument exception from JavaField.getInt(longValue)");
    } catch (IllegalArgumentException e) {
      // expected
   
  }
 
  public void testByteValue() throws Exception {
    JavaObject thisJavaObject = getScenerioReference();
    JavaField byteValueField = getJavaField(thisJavaObject, "byteValue");

    try{
      int aByteValue = byteValueField.getInt(thisJavaObject);
    } catch (IllegalArgumentException e) {
      fail("Unexpected illegal argument exception from JavaField.getInt(byteValue)");
   
  }
 
  public void testCharValue() throws Exception {
    JavaObject thisJavaObject = getScenerioReference();
    JavaField charValueField = getJavaField(thisJavaObject, "charValue");

    try{
      int aCharValue = charValueField.getInt(thisJavaObject);
    } catch (IllegalArgumentException e) {
      fail("Unexpected illegal argument exception from JavaField.getInt(charValue)");
   
  }
 
  public void testShortValue() throws Exception {
    JavaObject thisJavaObject = getScenerioReference();
    JavaField shortValueField = getJavaField(thisJavaObject, "shortValue");

    try{
      int aShortValue = shortValueField.getInt(thisJavaObject);
    } catch (IllegalArgumentException e) {
      fail("Unexpected illegal argument exception from JavaField.getInt(shortValue)");
   
  }
 
  public void testBooleanValue() throws Exception {
    JavaObject thisJavaObject = getScenerioReference();
    JavaField booleanValueField = getJavaField(thisJavaObject, "booleanValue");
   
    try{
      int aBooleanValue = booleanValueField.getInt(thisJavaObject);
      fail("Missing illegal argument exception from JavaField.getInteger(booleanValue)");
    } catch (IllegalArgumentException e) {
      // expected
    }
  }
 
  public void testObjectReference() throws Exception {
    JavaObject thisJavaObject = getScenerioReference();
    JavaField objectReferenceField = getJavaField(thisJavaObject, "objectReference");
   
    try{
      int anObjectReference = objectReferenceField.getInt(thisJavaObject);
      fail("Missing illegal argument exception from JavaField.getInteger(objectReference)");
    } catch (IllegalArgumentException e) {
      // expected
    }
  }
}
TOP

Related Classes of org.apache.kato.tck.scenario142.javaruntime.TestJavaField_getInt

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.