blob: 93c809845e8fbae248c7a405b52c8062bc734818 [file] [log] [blame]
/**
* 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.metron.dataloads.extractor;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import static org.hamcrest.Matchers.notNullValue;
import static org.mockito.Matchers.isA;
import static org.mockito.Mockito.verify;
public class ExtractorDecoratorTest {
@Mock
Extractor extractor;
@Before
public void before() {
MockitoAnnotations.initMocks(this);
}
@Test
public void sets_member_variables() {
ExtractorDecorator decorator = new ExtractorDecorator(extractor);
Assert.assertThat(decorator.decoratedExtractor, notNullValue());
}
@Test
public void calls_extractor_methods() throws IOException {
ExtractorDecorator decorator = new ExtractorDecorator(extractor);
decorator.initialize(new HashMap());
decorator.extract("line");
verify(extractor).initialize(isA(Map.class));
verify(extractor).extract("line");
}
}