Test init's Libraries class
This just verifies the libraries.config file can be parsed up at build time and pushed into the instance fields as LibraryDownloader objects. We don't actually validate any of the values within it, nor do we validate the downloaders work. Change-Id: Ib42e34da0f916eaf23f72aa20b35838f8c66c24f Signed-off-by: Shawn O. Pearce <sop@google.com>
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
// Copyright (C) 2009 The Android Open Source Project
|
||||
//
|
||||
// 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.google.gerrit.pgm.init;
|
||||
|
||||
import static org.easymock.classextension.EasyMock.createStrictMock;
|
||||
import static org.easymock.classextension.EasyMock.replay;
|
||||
import static org.easymock.classextension.EasyMock.verify;
|
||||
|
||||
import com.google.gerrit.pgm.util.ConsoleUI;
|
||||
import com.google.gerrit.server.config.SitePaths;
|
||||
import com.google.inject.Provider;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
|
||||
public class LibrariesTest extends TestCase {
|
||||
public void testCreate() throws FileNotFoundException {
|
||||
final SitePaths site = new SitePaths(new File("."));
|
||||
final ReloadSiteLibrary reload = createStrictMock(ReloadSiteLibrary.class);
|
||||
final ConsoleUI ui = createStrictMock(ConsoleUI.class);
|
||||
|
||||
replay(ui);
|
||||
replay(reload);
|
||||
|
||||
Libraries lib = new Libraries(new Provider<LibraryDownloader>() {
|
||||
@Override
|
||||
public LibraryDownloader get() {
|
||||
return new LibraryDownloader(reload, ui, site);
|
||||
}
|
||||
});
|
||||
|
||||
assertNotNull(lib.bouncyCastle);
|
||||
assertNotNull(lib.mysqlDriver);
|
||||
|
||||
verify(ui);
|
||||
verify(reload);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user