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

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

/*******************************************************************************
* 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_getShort;


/**
* Test JavaField.getShort() against various fields and values.
*
*/
public class TestJavaField_getShort extends TCKJavaRuntimeTestcase {
 
  SetupJavaField_getShort setup=new SetupJavaField_getShort();
 
  static JavaObject thisObject = null
  public JavaObject getScenerioReference() {
    if (thisObject == null) {
      thisObject = super.getScenerioReference();
   
    return thisObject;   
  }
 
  public void testMaxShortValue() throws Exception {
    JavaObject thisJavaObject = getScenerioReference();
    JavaField maxShortField = getJavaField(thisJavaObject, "maxShort");
   
    short maxShortValue = maxShortField.getShort(thisJavaObject);
   
    assertEquals(setup.maxShort, maxShortValue);   
  }
 
  public void testMinShortValue() throws Exception {
    JavaObject thisJavaObject = getScenerioReference();
    JavaField minShortField = getJavaField(thisJavaObject, "minShort");
   
    short minShortValue = minShortField.getShort(thisJavaObject);
   
    assertEquals(setup.minShort, minShortValue);   
  }

  public void testStaticMinShortValue() throws Exception {
    JavaObject thisJavaObject = getScenerioReference();
    JavaField minShortField = getJavaField(thisJavaObject, "staticMinShort");
   
    short minShortValue = minShortField.getShort(null);
   
    assertEquals(SetupJavaField_getShort.staticMinShort, minShortValue);   
  }
 
  public void testZeroShortValue() throws Exception {
    JavaObject thisJavaObject = getScenerioReference();
    JavaField zeroShortField = getJavaField(thisJavaObject, "zeroShort");
   
    short zeroShortValue = zeroShortField.getShort(thisJavaObject);
   
    assertEquals(setup.zeroShort, zeroShortValue);   
  }
 
  public void testNegShortValue() throws Exception {
    JavaObject thisJavaObject = getScenerioReference();
    JavaField negShortField = getJavaField(thisJavaObject, "negShort");
   
    short negShortValue = negShortField.getShort(thisJavaObject);
   
    assertEquals(setup.negShort, negShortValue);   
 
 
  public void testPosShortValue() throws Exception {
    JavaObject thisJavaObject = getScenerioReference();
    JavaField posShortField = getJavaField(thisJavaObject, "posShort");
   
    short posShortValue = posShortField.getShort(thisJavaObject);
   
    assertEquals(setup.posShort, posShortValue);   
  }


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

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

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

    try{
      short aLongValue = longValueField.getShort(thisJavaObject);
      fail("Missing illegal argument exception from JavaField.getShort(longValue)");
    } catch (IllegalArgumentException e) {
      // expected
   
  }
 
  public void testIntValue() throws Exception {
    JavaObject thisJavaObject = getScenerioReference();
    JavaField intValueField = getJavaField(thisJavaObject, "intValue");

    try{
      short aIntValue = intValueField.getShort(thisJavaObject);
      fail("Missing illegal argument exception from JavaField.getShort(intValue)");
    } catch (IllegalArgumentException e) {
      // expected
   
  }
 
  public void testByteValue() throws Exception {
    JavaObject thisJavaObject = getScenerioReference();
    JavaField byteValueField = getJavaField(thisJavaObject, "byteValue");

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

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

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

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.