
com.jayway.restassured.TestGroovy.groovy Maven / Gradle / Ivy
/*
* Copyright 2011 the original author or authors.
*
* 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 com.jayway.restassured
class TestGroovy {
public static void main(String...string ) {
def input = '''
hej
- Chocolate
- Coffee
- Paper
- Pens
- Kathryn's Birthday
'''
def textHtml = '''
my title
paragraph 1
paragraph 2
'''
private final String XML = "\n" +
" \n" +
" - \n" +
"\t
Chocolate \n" +
" 10 \n" +
"\t \n" +
" - \n" +
"\t
Coffee \n" +
" 20 \n" +
"\t \n" +
" \n" +
" \n" +
" - \n" +
"\t
Paper \n" +
" 5 \n" +
"\t \n" +
" - \n" +
"
Pens \n" +
" 15 \n" +
"\t \n" +
" \n" +
" \n" +
" - \n" +
"
Kathryn's Birthday \n" +
" 200 \n" +
" \n" +
" \n" +
" ";
def greeting = '''John
Doe
'''
def anotherGreeting = '''
firstName
lastName
'''
def json = "{ \"store\": {\n" +
" \"book\": [ \n" +
" { \"category\": \"reference\",\n" +
" \"author\": \"Nigel Rees\",\n" +
" \"title\": \"Sayings of the Century\",\n" +
" \"price\": 8.95\n" +
" },\n" +
" { \"category\": \"fiction\",\n" +
" \"author\": \"Evelyn Waugh\",\n" +
" \"title\": \"Sword of Honour\",\n" +
" \"price\": 12.99\n" +
" },\n" +
" { \"category\": \"fiction\",\n" +
" \"author\": \"Herman Melville\",\n" +
" \"title\": \"Moby Dick\",\n" +
" \"isbn\": \"0-553-21311-3\",\n" +
" \"price\": 8.99\n" +
" },\n" +
" { \"category\": \"fiction\",\n" +
" \"author\": \"J. R. R. Tolkien\",\n" +
" \"title\": \"The Lord of the Rings\",\n" +
" \"isbn\": \"0-395-19395-8\",\n" +
" \"price\": 22.99\n" +
" }\n" +
" ],\n" +
" \"bicycle\": {\n" +
" \"color\": \"red\",\n" +
" \"price\": 19.95,\n" +
" }\n" +
" }\n" +
"}";
def root = new XmlSlurper().parseText(XML)
// def root = new JsonSlurper().parseText(json);
System.out.println(root.category[0].getClass())
// System.out.println(root.category[0].item[0].name);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy