Author: veithen Date: Sat Oct 3 10:16:04 2015 New Revision: 1706537 URL: http://svn.apache.org/viewvc?rev=1706537&view=rev Log: Increase test coverage.
Added: webservices/axiom/trunk/testing/fom-testsuite/src/main/java/org/apache/axiom/ts/fom/feed/ webservices/axiom/trunk/testing/fom-testsuite/src/main/java/org/apache/axiom/ts/fom/feed/AddChildWithExistingEntryTestCase.java (with props) webservices/axiom/trunk/testing/fom-testsuite/src/main/java/org/apache/axiom/ts/fom/feed/TestAddAuthorWithExistingEntry1.java (with props) webservices/axiom/trunk/testing/fom-testsuite/src/main/java/org/apache/axiom/ts/fom/feed/TestAddAuthorWithExistingEntry2.java (with props) Modified: webservices/axiom/trunk/testing/fom-testsuite/src/main/java/org/apache/axiom/ts/fom/FOMTestSuiteBuilder.java webservices/axiom/trunk/testing/fom-testsuite/src/test/java/org/apache/axiom/ts/fom/AbderaTest.java Modified: webservices/axiom/trunk/testing/fom-testsuite/src/main/java/org/apache/axiom/ts/fom/FOMTestSuiteBuilder.java URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/testing/fom-testsuite/src/main/java/org/apache/axiom/ts/fom/FOMTestSuiteBuilder.java?rev=1706537&r1=1706536&r2=1706537&view=diff ============================================================================== --- webservices/axiom/trunk/testing/fom-testsuite/src/main/java/org/apache/axiom/ts/fom/FOMTestSuiteBuilder.java (original) +++ webservices/axiom/trunk/testing/fom-testsuite/src/main/java/org/apache/axiom/ts/fom/FOMTestSuiteBuilder.java Sat Oct 3 10:16:04 2015 @@ -43,6 +43,8 @@ public class FOMTestSuiteBuilder extends addTest(new org.apache.axiom.ts.fom.control.TestSetUnsetDraft(abdera)); addTest(new org.apache.axiom.ts.fom.entry.TestAddCategoryFromCategories(abdera)); addTest(new org.apache.axiom.ts.fom.entry.TestGetCategoriesByScheme(abdera)); + addTest(new org.apache.axiom.ts.fom.feed.TestAddAuthorWithExistingEntry1(abdera)); + addTest(new org.apache.axiom.ts.fom.feed.TestAddAuthorWithExistingEntry2(abdera)); addTest(new org.apache.axiom.ts.fom.person.TestSetEmail(abdera)); } } Added: webservices/axiom/trunk/testing/fom-testsuite/src/main/java/org/apache/axiom/ts/fom/feed/AddChildWithExistingEntryTestCase.java URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/testing/fom-testsuite/src/main/java/org/apache/axiom/ts/fom/feed/AddChildWithExistingEntryTestCase.java?rev=1706537&view=auto ============================================================================== --- webservices/axiom/trunk/testing/fom-testsuite/src/main/java/org/apache/axiom/ts/fom/feed/AddChildWithExistingEntryTestCase.java (added) +++ webservices/axiom/trunk/testing/fom-testsuite/src/main/java/org/apache/axiom/ts/fom/feed/AddChildWithExistingEntryTestCase.java Sat Oct 3 10:16:04 2015 @@ -0,0 +1,46 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.axiom.ts.fom.feed; + +import static com.google.common.truth.Truth.assertThat; + +import org.apache.abdera.Abdera; +import org.apache.abdera.model.Element; +import org.apache.abdera.model.Entry; +import org.apache.abdera.model.Feed; +import org.apache.axiom.ts.fom.AbderaTestCase; + +public abstract class AddChildWithExistingEntryTestCase extends AbderaTestCase { + public AddChildWithExistingEntryTestCase(Abdera abdera) { + super(abdera); + } + + @Override + protected void runTest() throws Throwable { + Feed feed = abdera.getFactory().newFeed(); + Entry entry = feed.addEntry(); + Element addedChild = addChild(feed); + Element child = feed.getFirstChild(); + // Entries must come after any other type of child elements + assertThat(child).isSameAs(addedChild); + assertThat(child.getNextSibling()).isSameAs(entry); + } + + protected abstract Element addChild(Feed feed); +} Propchange: webservices/axiom/trunk/testing/fom-testsuite/src/main/java/org/apache/axiom/ts/fom/feed/AddChildWithExistingEntryTestCase.java ------------------------------------------------------------------------------ svn:eol-style = native Added: webservices/axiom/trunk/testing/fom-testsuite/src/main/java/org/apache/axiom/ts/fom/feed/TestAddAuthorWithExistingEntry1.java URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/testing/fom-testsuite/src/main/java/org/apache/axiom/ts/fom/feed/TestAddAuthorWithExistingEntry1.java?rev=1706537&view=auto ============================================================================== --- webservices/axiom/trunk/testing/fom-testsuite/src/main/java/org/apache/axiom/ts/fom/feed/TestAddAuthorWithExistingEntry1.java (added) +++ webservices/axiom/trunk/testing/fom-testsuite/src/main/java/org/apache/axiom/ts/fom/feed/TestAddAuthorWithExistingEntry1.java Sat Oct 3 10:16:04 2015 @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.axiom.ts.fom.feed; + +import org.apache.abdera.Abdera; +import org.apache.abdera.model.Element; +import org.apache.abdera.model.Feed; +import org.apache.abdera.model.Person; + +public class TestAddAuthorWithExistingEntry1 extends AddChildWithExistingEntryTestCase { + public TestAddAuthorWithExistingEntry1(Abdera abdera) { + super(abdera); + } + + @Override + protected Element addChild(Feed feed) { + Person person = feed.getFactory().newAuthor(); + person.setName("Me"); + feed.addAuthor(person); + return person; + } +} Propchange: webservices/axiom/trunk/testing/fom-testsuite/src/main/java/org/apache/axiom/ts/fom/feed/TestAddAuthorWithExistingEntry1.java ------------------------------------------------------------------------------ svn:eol-style = native Added: webservices/axiom/trunk/testing/fom-testsuite/src/main/java/org/apache/axiom/ts/fom/feed/TestAddAuthorWithExistingEntry2.java URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/testing/fom-testsuite/src/main/java/org/apache/axiom/ts/fom/feed/TestAddAuthorWithExistingEntry2.java?rev=1706537&view=auto ============================================================================== --- webservices/axiom/trunk/testing/fom-testsuite/src/main/java/org/apache/axiom/ts/fom/feed/TestAddAuthorWithExistingEntry2.java (added) +++ webservices/axiom/trunk/testing/fom-testsuite/src/main/java/org/apache/axiom/ts/fom/feed/TestAddAuthorWithExistingEntry2.java Sat Oct 3 10:16:04 2015 @@ -0,0 +1,34 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.axiom.ts.fom.feed; + +import org.apache.abdera.Abdera; +import org.apache.abdera.model.Element; +import org.apache.abdera.model.Feed; + +public class TestAddAuthorWithExistingEntry2 extends AddChildWithExistingEntryTestCase { + public TestAddAuthorWithExistingEntry2(Abdera abdera) { + super(abdera); + } + + @Override + protected Element addChild(Feed feed) { + return feed.addAuthor("Me"); + } +} Propchange: webservices/axiom/trunk/testing/fom-testsuite/src/main/java/org/apache/axiom/ts/fom/feed/TestAddAuthorWithExistingEntry2.java ------------------------------------------------------------------------------ svn:eol-style = native Modified: webservices/axiom/trunk/testing/fom-testsuite/src/test/java/org/apache/axiom/ts/fom/AbderaTest.java URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/testing/fom-testsuite/src/test/java/org/apache/axiom/ts/fom/AbderaTest.java?rev=1706537&r1=1706536&r2=1706537&view=diff ============================================================================== --- webservices/axiom/trunk/testing/fom-testsuite/src/test/java/org/apache/axiom/ts/fom/AbderaTest.java (original) +++ webservices/axiom/trunk/testing/fom-testsuite/src/test/java/org/apache/axiom/ts/fom/AbderaTest.java Sat Oct 3 10:16:04 2015 @@ -24,6 +24,7 @@ import junit.framework.TestSuite; import org.apache.abdera.Abdera; import org.apache.axiom.ts.fom.collection.TestSetAcceptRemove; import org.apache.axiom.ts.fom.control.TestSetUnsetDraft; +import org.apache.axiom.ts.fom.feed.TestAddAuthorWithExistingEntry2; public class AbderaTest extends TestCase { public static TestSuite suite() { @@ -33,6 +34,8 @@ public class AbderaTest extends TestCase builder.exclude(TestSetUnsetDraft.class); // Fails with ConcurrentModificationException builder.exclude(TestSetAcceptRemove.class); + // Broken in Abdera 1.1.3 + builder.exclude(TestAddAuthorWithExistingEntry2.class); return builder.build(); }