// Path: src/test/java/ninja/eivind/testutils/DataObjectTester.java
// public class DataObjectTester<T> {
// 
//     private Class<T> clazz;
//     private T object;
// 
//     public DataObjectTester(Class<T> clazz, T object) {
//         this.clazz = clazz;
//         this.object = object;
//     }
// 
//     public void testAllFieldsArePrivate() {
//         final Field[] fields = clazz.getDeclaredFields();
// 
//         for (final Field field : fields) {
//             assertFalse("Field is not accessible", field.isAccessible());
//         }
//     }
// 
//     public void testAllFieldsHaveProperGetters() throws Exception {
//         final Field[] fields = clazz.getDeclaredFields();
// 
//         for (final Field field : fields) {
//             final String fieldName = field.getName();
//             char[] fieldNameChars = fieldName.toCharArray();
//             fieldNameChars[0] = Character.toUpperCase(fieldNameChars[0]);
//             String upperCasedFieldName = new String(fieldNameChars);
// 
//             Method method = clazz.getMethod("get" + upperCasedFieldName);
//             boolean getterIsAccessible = method.getModifiers() == Modifier.PUBLIC;
//             if (getterIsAccessible) {
//                 field.setAccessible(true);
//                 Object invoke = method.invoke(object);
//                 assertEquals("Getter returns an equal object to the field object", field.get(object), invoke);
//             }
//         }
//     }
// 
//     public void run() throws Exception {
//         testAllFieldsArePrivate();
//         testAllFieldsHaveProperGetters();
//     }
// }


import ninja.eivind.testutils.DataObjectTester;
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
// Copyright 2015 Eivind Vegsundvåg
//
// 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 ninja.eivind.hotsreplayuploader.models;



/**
 * Unit testing for Account class
 */
public class AccountTest {
    private static final Long PLAYERID = 1234L;
    private static final String PLAYER_NAME = "Eivind";
    // Set of necessary variables for testing
    private Account account;

    @Before
    public void setup() {
        // Initializing variables
        account = new Account();
        account.setPlayerId(PLAYERID);
        account.setName(PLAYER_NAME);
    }

    @Test
    public void testClassIsValidDataObject() throws Exception {
        // Verifying that the Account object is an actual object and contains
        // all neccessary getters and setters
// Path: src/test/java/ninja/eivind/testutils/DataObjectTester.java
// public class DataObjectTester<T> {
// 
//     private Class<T> clazz;
//     private T object;
// 
//     public DataObjectTester(Class<T> clazz, T object) {
//         this.clazz = clazz;
//         this.object = object;
//     }
// 
//     public void testAllFieldsArePrivate() {
//         final Field[] fields = clazz.getDeclaredFields();
// 
//         for (final Field field : fields) {
//             assertFalse("Field is not accessible", field.isAccessible());
//         }
//     }
// 
//     public void testAllFieldsHaveProperGetters() throws Exception {
//         final Field[] fields = clazz.getDeclaredFields();
// 
//         for (final Field field : fields) {
//             final String fieldName = field.getName();
//             char[] fieldNameChars = fieldName.toCharArray();
//             fieldNameChars[0] = Character.toUpperCase(fieldNameChars[0]);
//             String upperCasedFieldName = new String(fieldNameChars);
// 
//             Method method = clazz.getMethod("get" + upperCasedFieldName);
//             boolean getterIsAccessible = method.getModifiers() == Modifier.PUBLIC;
//             if (getterIsAccessible) {
//                 field.setAccessible(true);
//                 Object invoke = method.invoke(object);
//                 assertEquals("Getter returns an equal object to the field object", field.get(object), invoke);
//             }
//         }
//     }
// 
//     public void run() throws Exception {
//         testAllFieldsArePrivate();
//         testAllFieldsHaveProperGetters();
//     }
// }


// Path: src/test/java/ninja/eivind/hotsreplayuploader/models/AccountTest.java
import ninja.eivind.testutils.DataObjectTester;
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.assertEquals;

// Copyright 2015 Eivind Vegsundvåg
//
// 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 ninja.eivind.hotsreplayuploader.models;



/**
 * Unit testing for Account class
 */
public class AccountTest {
    private static final Long PLAYERID = 1234L;
    private static final String PLAYER_NAME = "Eivind";
    // Set of necessary variables for testing
    private Account account;

    @Before
    public void setup() {
        // Initializing variables
        account = new Account();
        account.setPlayerId(PLAYERID);
        account.setName(PLAYER_NAME);
    }

    @Test
    public void testClassIsValidDataObject() throws Exception {
        // Verifying that the Account object is an actual object and contains
        // all neccessary getters and setters
        DataObjectTester<Account> tester = new DataObjectTester<>(Account.class, account);