"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "core/src/test/java/hudson/util/RobustReflectionConverterTest.java" between
jenkins-jenkins-2.302.tar.gz and jenkins-jenkins-2.303.tar.gz

About: Jenkins is a automation server (written in Java) which can be used to automate all sorts of tasks related to building, testing, and delivering or deploying software (for e.g. as Continuous Integration and Continuous Delivery server). Weekly release.

RobustReflectionConverterTest.java  (jenkins-jenkins-2.302):RobustReflectionConverterTest.java  (jenkins-jenkins-2.303)
skipping to change at line 26 skipping to change at line 26
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. * THE SOFTWARE.
*/ */
package hudson.util; package hudson.util;
import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertThrows;
import static org.junit.Assert.fail;
import com.thoughtworks.xstream.XStream; import com.thoughtworks.xstream.XStream;
import com.thoughtworks.xstream.converters.ConversionException; import com.thoughtworks.xstream.converters.ConversionException;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy; import java.lang.annotation.RetentionPolicy;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import org.junit.Test; import org.junit.Test;
skipping to change at line 63 skipping to change at line 64
assertEquals(2, p.y); assertEquals(2, p.y);
} }
private Point read(XStream xs) { private Point read(XStream xs) {
String clsName = Point.class.getName(); String clsName = Point.class.getName();
return (Point) xs.fromXML("<" + clsName + "><x>1</x><y>2</y><z>3</z></" + clsName + '>'); return (Point) xs.fromXML("<" + clsName + "><x>1</x><y>2</y><z>3</z></" + clsName + '>');
} }
@Test @Test
public void ifWorkaroundNeeded() { public void ifWorkaroundNeeded() {
try { final ConversionException e = assertThrows(ConversionException.class, ()
read(new XStream()); -> read(new XStream()));
fail(); assertThat(e.getMessage(), containsString("z"));
} catch (ConversionException e) {
// expected
assertTrue(e.getMessage().contains("z"));
}
} }
@Test @Test
public void classOwnership() { public void classOwnership() {
XStream xs = new XStream2(new XStream2.ClassOwnership() { XStream xs = new XStream2(clazz -> {
@Override public String ownerOf(Class<?> clazz) { Owner o = clazz.getAnnotation(Owner.class);
Owner o = clazz.getAnnotation(Owner.class); return o != null ? o.value() : null;
return o != null ? o.value() : null;
}
}); });
String prefix1 = RobustReflectionConverterTest.class.getName() + "_-"; String prefix1 = RobustReflectionConverterTest.class.getName() + "_-";
String prefix2 = RobustReflectionConverterTest.class.getName() + "$"; String prefix2 = RobustReflectionConverterTest.class.getName() + "$";
Enchufla s1 = new Enchufla(); Enchufla s1 = new Enchufla();
s1.number = 1; s1.number = 1;
s1.direction = "North"; s1.direction = "North";
Moonwalk s2 = new Moonwalk(); Moonwalk s2 = new Moonwalk();
s2.number = 2; s2.number = 2;
s2.boot = new Boot(); s2.boot = new Boot();
s2.lover = new Billy(); s2.lover = new Billy();
 End of changes. 4 change blocks. 
14 lines changed or deleted 9 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)