/*
 *  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.isis.core.metamodel.facets.object.recreatable;

import org.apache.isis.applib.ViewModel;
import org.apache.isis.core.metamodel.facetapi.Facet;
import org.apache.isis.core.metamodel.facets.AbstractFacetFactoryTest;
import org.apache.isis.core.metamodel.facets.FacetFactory.ProcessClassContext;
import org.apache.isis.core.metamodel.facets.object.viewmodel.ViewModelFacetFactory;
import org.apache.isis.core.metamodel.facets.object.viewmodel.ViewModelFacetForViewModelInterface;
import org.apache.isis.core.metamodel.facets.object.viewmodel.ViewModelFacet;
import org.apache.isis.core.metamodel.methods.MethodByClassMap;

public class RecreatableObjectFacetFactoryTest
extends AbstractFacetFactoryTest {

    private ViewModelFacetFactory facetFactory;

    @Override
    protected void setUp() throws Exception {
        super.setUp();

        facetFactory = new ViewModelFacetFactory(metaModelContext, new MethodByClassMap());
    }

    @Override
    protected void tearDown() throws Exception {
        facetFactory = null;
        super.tearDown();
    }

    public void testViewModelInterfacePickedUpOnClassAndDefaultsToAlways() {
        class Customer implements ViewModel {

            @Override
            public String viewModelMemento() {
                return null;
            }


            @SuppressWarnings("unused")
            public Customer(final String memento) {
            }

        }

        facetFactory.process(ProcessClassContext
                .forTesting(Customer.class, methodRemover, facetedMethod));

        final Facet facet = facetedMethod.getFacet(ViewModelFacet.class);
        assertNotNull(facet);
        assertTrue(facet instanceof ViewModelFacetForViewModelInterface);

        assertNoMethodsRemoved();
    }

}

@@ -1131,16 +1131,94 @@
 ontext;%0A
+import org.apache.isis.core.metamodel.facets.object.viewmodel.ViewModelFacet;%0A
 import o
@@ -1397,86 +1397,8 @@
 ce;%0A
-import org.apache.isis.core.metamodel.facets.object.viewmodel.ViewModelFacet;%0A
 impo
@@ -1906,88 +1906,14 @@
     
-public void testViewModelInterfacePickedUpOnClassAndDefaultsToAlways() %7B%0A       
+static
  cla
@@ -1956,20 +1956,16 @@
         
-   
- 
 @Overrid
@@ -1966,20 +1966,16 @@
 verride%0A
-    
         
@@ -2021,20 +2021,16 @@
         
-    
 return n
@@ -2030,28 +2030,24 @@
 eturn null;%0A
-    
         %7D%0A%0A%0A
@@ -2049,53 +2049,8 @@
  %7D%0A%0A
-%0A            @SuppressWarnings(%22unused%22)%0A    
     
@@ -2097,24 +2097,26 @@
 ) %7B%0A        
+%7D%0A
     %7D%0A%0A     
@@ -2110,29 +2110,96 @@
 %0A    %7D%0A%0A    
-    %7D
+public void testViewModelInterfacePickedUpOnClassAndDefaultsToAlways() %7B
 %0A%0A        fa

test fixes