Skip to content

Commit

Permalink
El 168 - getType() must return null for read-only resolvers/properties
Browse files Browse the repository at this point in the history
  • Loading branch information
markt-asf committed Dec 20, 2021
1 parent 48bd5c0 commit 1e6aa69
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 42 deletions.
73 changes: 36 additions & 37 deletions src/com/sun/ts/tests/el/api/jakarta_el/beanelresolver/ELClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,44 +89,43 @@ public void beanELResolverTest() throws Fault {
TestUtil.logTrace(buf.toString());
}

// Disabled until EL #168 is addressed
//
// /**
// * @testName: beanELResolverDefaultMethodReadOnlyTest
// *
// * @assertion_ids: EL:JAVADOC:9; EL:JAVADOC:11; EL:JAVADOC:12; EL:JAVADOC:13;
// * EL:JAVADOC:14; EL:JAVADOC:15; EL:JAVADOC:16
// *
// * @test_Strategy: Verify that API calls work as expected when accessing
// * read-only properties defined via a default interface method
// */
// public void beanELResolverDefaultMethodReadOnlyTest() throws Fault {
//
// boolean pass = false;
// StringBuffer buf = new StringBuffer();
//
// try {
// BeanELResolver beanResolver = new BeanELResolver();
// BareBonesELContext barebonesContext = new BareBonesELContext();
// ELContext context = barebonesContext.getELContext();
//
// pass = ResolverTest.testELResolver(context, beanResolver, sb, "defaultRO",
// "RO", buf, true);
// } catch (Exception ex) {
// pass = false;
// TestUtil.logErr("Test of a valid expression using a Bean with a read-only " +
// "property implemented via default methods threw an Exception!" + TestUtil.NEW_LINE +
// "Received: " + ex.toString() + TestUtil.NEW_LINE);
//
// ex.printStackTrace();
// }
//
// if (!pass) {
// throw new Fault(ELTestUtil.FAIL + buf.toString());
// }
// TestUtil.logTrace(buf.toString());
// }
/**
* @testName: beanELResolverDefaultMethodReadOnlyTest
*
* @assertion_ids: EL:JAVADOC:9; EL:JAVADOC:11; EL:JAVADOC:12; EL:JAVADOC:13;
* EL:JAVADOC:14; EL:JAVADOC:15; EL:JAVADOC:16
*
* @test_Strategy: Verify that API calls work as expected when accessing
* read-only properties defined via a default interface method
*/
public void beanELResolverDefaultMethodReadOnlyTest() throws Fault {

boolean pass = false;
StringBuffer buf = new StringBuffer();

try {
BeanELResolver beanResolver = new BeanELResolver();
BareBonesELContext barebonesContext = new BareBonesELContext();
ELContext context = barebonesContext.getELContext();

pass = ResolverTest.testELResolver(context, beanResolver, sb, "defaultRO",
"RO", buf, true);
} catch (Exception ex) {
pass = false;
TestUtil.logErr("Test of a valid expression using a Bean with a read-only " +
"property implemented via default methods threw an Exception!" + TestUtil.NEW_LINE +
"Received: " + ex.toString() + TestUtil.NEW_LINE);

ex.printStackTrace();
}

if (!pass) {
throw new Fault(ELTestUtil.FAIL + buf.toString());
}
TestUtil.logTrace(buf.toString());
}


/**
* @testName: beanELResolverDefaultMethodReadWriteTest
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2020 Oracle and/or its affiliates and others.
* Copyright (c) 2012, 2021 Oracle and/or its affiliates and others.
* All rights reserved.
*
* This program and the accompanying materials are made available under the
Expand Down Expand Up @@ -125,10 +125,11 @@ public void staticFieldELResolverTest() throws Fault {
if (!context.isPropertyResolved()) {
buf.append("getType() did not resolve" + TestUtil.NEW_LINE);
pass = false;

} else if (type.isInstance(String.class)) {
buf.append("getType() returns " + type.getName() + TestUtil.NEW_LINE
+ "as expected." + TestUtil.NEW_LINE);
} else if (type != null) {
buf.append("getType() returns " + type.getName() + " rather than null" + TestUtil.NEW_LINE);
pass = false;
} else {
buf.append("getType() returns null" + TestUtil.NEW_LINE + "as expected." + TestUtil.NEW_LINE);
}

// isReadOnly
Expand Down

0 comments on commit 1e6aa69

Please sign in to comment.